I want to get null when both exp are not matched like nullif(exp1,exp2) will return null when same and return first exp when not same.
i have tried with the help of sub query or creating functions but need a simple, easy, standard way out.
select * from table
where service_type = 'X3'
or (1 <> (select nvl(min(1),2) from table where service_type = 'X3')
and service_type is null)
This query returns my desire result but i need not to use a sub query.
table have data like
service_type
------------
X4
X3
null
I want to get if service_type match X3 value returns X3 but if not matched like X5 then return null to match null record.
When service_type = 'X3'
service_type
------------
X3
When service_type = 'X5' or any other like 'X%' will return null
service_type
------------
null