I know I've seen this somewhere.
How do I search a table to see if it contains a specific value?
Ex: If I have 1000 names and I want to see if there is anyone named 'Smith'. I don't want to search
the whole table. I want to stop when I find a record with the name 'Smith' and return a value
(0 or 1 I guess) depending on wherther I find it or not.
select 1 from dual
where exists (select 1 from emp where name like '%Smith%' )
union
select 0 from dual
where not exists (select 1 from emp where name like '%Smith%' )
Bookmarks