How to use If condition inside a Case statement? How to use If condition inside a Case statement? oracle oracle

How to use If condition inside a Case statement?


You can either put another case or use decode (as @madhu suggested):

select case   when value in (1000) then null  when user in ('ABC') then user  when area in ('DENVER') then    case when value = 2000 then 'Service1'         when value = 3000 then 'Service2'    end   else null  end as num_code from service_usoc_ref;


This could help you

 select  case when value in (1000) then null                         when user in ('ABC') then user                       when area in ('DENVER') thendecode( value, 2000 , 'Service1',3000 , 'Service2', NULL)  num_code from service_usoc_ref;