Using Case expressions in oracle along side exists clause.
select (case when exists(select COLUMN from SCHEMA.TABLE where COLUMN='abc') THEN 1 when exists(select CODE from SCHEMA.TABLE2 where COLUMN='abc') THEN 2 ELSE 0 END) as returnvalue from dual;
No comments:
Post a Comment