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: Q: To check a record's existence in a table, FAST!

Re: Q: To check a record's existence in a table, FAST!

From: Bud Lo <budlo_at_netvigator.com>
Date: 1997/04/19
Message-ID: <3358d711.359605@news.netvigator.com>#1/1

On Sat, 19 Apr 1997 13:05:48 +0000, Chrysalis <cellis_at_iol.ie> wrote:

>*Never* select count(*) unless you really want to count all the rows!
>Your first solution (select null from dual where xists (subquery) will
>do, since an <exists> subquery stops when the first row is found.
>
>However, I notice you are using select .. into ...
>Does this mean you are using PL/SQL or SQL*Forms or what?
>
> Many questions in this NG are concerned with returning the first row
>(or first n rows) and people seem to want a solution which works in
>SQL*Plus, but SQL*Plus is not the best vehicle for this, since you have
>no direct control over the number of rows fetched (rownum is almost
>useless unless you don't care about sequence).
> Almost any other interface (e.g. PL/SQL, Forms, etc) allow you to
>declare and open a cursor and then fetch exactly the number of rows you
>want.
>

i forgot to mention that i don't want to use cursor to achieve that. As you mention, if the sequence is immaterial, is the rownum solution works as i required?? That is, it stops when the 1st record is found, if any, and returns.

Thanks,
Bud Received on Sat Apr 19 1997 - 00:00:00 CDT

Original text of this message

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