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: Mon, 09 May 2005 22:15:32 +0200
Message-ID: <d5og57$je0$1@news3.zwoll1.ov.home.nl>


abc wrote:
> All,
>
> Kind of a new person here and this may be a stupid question but.
>
> We have a table with 20 columns and many millions of records. I need to
> check if the combination of 5 of those columns exists anywhere in the table.
> It does not matter how many times it exists in the table but only if the
> combination exists in the table.
>
> 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.

-- 
Regards,
Frank van Bortel
Received on Mon May 09 2005 - 15:15:32 CDT

Original text of this message

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