Skip to content
Advertisement

CASE (IF ELSE )

if else statement in oracle with condition

 SELECT (CASE
               WHEN b.status IN ('AC', 'AB')
                  THEN a.coulmn_id = c.coulmn_id 
               WHEN b.status IN ('GC')
                  THEN a.coulmn_id = 241
            END
           ) status
      FROM table_1 a,
           table_2 b,
           table_3 c

Advertisement

Answer

What you posted doesn’t make sense; as if that CASE was supposed to be in the WHERE clause, e.g.

select ...
from table_1 a, table_2 b, table_3 c
where a.column_id = case when b.status in ('AC', 'AB') then c.column_id
                         when b.status in ('GC') then 241
                    end
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement