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: fastest way to determine if 0 or more records are present in table?

Re: fastest way to determine if 0 or more records are present in table?

From: Frank van Bortel <fvanbortel_at_netscape.net>
Date: Sat, 21 Feb 2004 17:18:08 +0100
Message-ID: <c1809l$8sj$1@news1.tilbu1.nb.home.nl>


Connor McDonald wrote:
[snip!]

>>
>>What's wrong with an old fashioned cursor?
>>Open it, read - if it fails: no records, if it doesn't: you
>>have one or more records.
>>
>>Requires 1 read.
>>
>>You do not want to know how many, you just
>>want to know if any - so don't use a count.
>>(After Steven Feuerstein)
>>--
>>
>>Regards,
>>Frank van Bortel

>
>
> The only problem with
>
> open cur
> fetch
> close
>
> is that you've given Oracle no information as to the fact that you're
> just doing an existence check. The way to do this would be to add "and
> rownum=1" or the wrapper with dual as previously posted.
>
> hth
> connor

Hmmm - are you suggesting Oracle reads more than I requested? Let's see what Flavio's tests prove, or elaborate, please.
-- 

Regards,
Frank van Bortel
Received on Sat Feb 21 2004 - 10:18:08 CST

Original text of this message

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