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: Query that fetch whether any record exist

Re: Query that fetch whether any record exist

From: mig <oxe_at_xinfo.dk>
Date: Mon, 10 Jan 2000 21:01:34 +0100
Message-ID: <NWqe4.445$ET1.1292@news.get2net.dk>


does anyone knows if it helps to write

where...
if rownum < 2

in the exists - sub-query?
akarb_at_xinfo.dk

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Remco Blaakmeer wrote in message <85b7pe$95k$1_at_rd1936.quicknet.nl>...
>In article <85ad31$jeh$1_at_news.netvision.net.il>,
> "Maoz Mussel" <maoz_at_mindcti.com> writes:
>> What is the fastest method to check whether ANY record satesfy the
>> WHERE clause? For example, the following query:
>> SELECT COUNT (*) FROM tableX
>> WHERE ...
>> May require full table scan in order to return number of records with the
>> specified criteria. Same with any MIN function usage, while all I want is
>> a boolean value specifying whether any record exist, i.e. one that will
>> stop execution once the first record is found.
>
>SELECT 'yes, a record satisfies the WHERE clause'
>FROM dual
>WHERE EXISTS ( SELECT 'x' FROM tablea WHERE ... )
>
>The EXISTS clause will return TRUE at the first row returned from the
>subquery. No more than one row will be fetched from the subquery.
>
>Remco
>--
>rd1936: 12:55am up 1 day, 5:34, 8 users, load average: 2.54, 2.33, 2.33
Received on Mon Jan 10 2000 - 14:01:34 CST

Original text of this message

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