sql - Where Clause Case Statement; ORA-00907: missing parenthesis -
i have query , when run error message ora-00907: missing parenthesis. when replace case statement either x = g and or y = g and runs expected.
select * table1, table2, table3, table4, table5, table6, table7, table8 = b , c = d , e = d , case strfldvar when 'broken_arrow' (x = g) when 'broken_box' (y = g) else -1 end , f = h , = j
what doing wrong here?
case
expression, not predicate (i.e condition) : 'returns' typed value , can not contain predicate result (in then
parts). in case (assuming else -1
means 'no match') :
and g = case strfldvar when 'broken_arrow' x when 'broken_box' y else null -- never match, if g null end
although think simpler replace :
and ( (strfldvar = 'broken_arrow' , x = g) or (strfldvar = 'broken_box' , y = g) )
Comments
Post a Comment