Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Getting the first matching record???
george wrote:
>
> Try 'exists': I.E.
>
> select 'X' from dual where
> exists (select blah blah blah from...
>
> exists is supposed to stop after the first matching row is found.
>
I think you are working under a mis-understanding here. The sub-query will stop when the first record is found, but you have no data from that record. This will tell you whether a matching record exists, but he wanted to RETURN the first matching record.
The obvious way (as has already been suggested) is a cursor.
-- The above posting represents the personal opinions of the author and is not to be taken as official (or unofficial) policy or opinions of his employer. Alex Heney, Living in the Global Village.Received on Fri Apr 18 1997 - 00:00:00 CDT