Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Checking if more than 0 rows exist.

Re: Checking if more than 0 rows exist.

From: Frank van Bortel <fvanbortel_at_netscape.net>
Date: Tue, 10 May 2005 10:44:02 +0200
Message-ID: <d5ps0j$39a$1@news5.zwoll1.ov.home.nl>


Jeremy wrote:
> In article <d5og57$je0$1_at_news3.zwoll1.ov.home.nl>, Frank van Bortel
> says...
>

>>>Select count(*) from combo_table where all fields match would count them all 
>>>but all I really need to know is if any exist (>0 rows).
>>>
>>
>>Right question: define a cursor with all 5 columns concerned.
>>Open the cursor - (attempt to) fetch any record.
>>If found, you're OK - close cursor, 1 read done.
>>If not found, you're OK - close cursor, 1 read done.
>>
>>

>
>
>
> Do you think this is a better approach than using EXISTS as suggested
> (and proved to be faster) by Phil?
>

I have not seen any comparism - you'll have to do that. Basically, an exists will do something similar; stop reading after the first match.
-- 
Regards,
Frank van Bortel
Received on Tue May 10 2005 - 03:44:02 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US