oracle - SQL - missing keyword in case when syntax -


i getting error message

missing keyword

any suggestions?

case when       substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4)>=0           , substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4) < 4000           'asset' else case when           substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4)>=4000              , substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4) < 8000           'liability'  else case when           substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4)>=8000             , substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4) < 9000            'off balance sheet asset'  else case when           substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4)>=9000           , substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4) < 10000           'off balance sheet liability' end asset_type, 

i think using more "case" word in case statement. remove "else case" after each "then". refer oracle documentation

case when       substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4)>=0           , substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4) < 4000           'asset'      when           substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4)>=4000              , substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4) < 8000           'liability'       when           substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4)>=8000             , substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4) < 9000            'off balance sheet asset'      when           substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4)>=9000           , substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4) < 10000           'off balance sheet liability'   end asset_type, 

the general syntax be

case      when col = 1 'active'     when col = 2 'inactive'     when col = 3 'terminated'  end statustext  

Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -