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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Getting the first matching record???

Re: Getting the first matching record???

From: george <wgweis_at_ucdavis.edu>
Date: 1997/04/17
Message-ID: <5j6593$rfn$1@mark.ucdavis.edu>#1/1

Try 'exists': I.E.

select 'X' from dual where
exists (select blah blah blah from...

exists is supposed to stop after the first matching row is found.

rbs_at_nyic.com (Frances Edelstein) wrote:

>In article <334bd241.9605767_at_news.cac.psu.edu>, zlm101_at_psu.edu says...
>>
>> I have a large table (about 4 million rows) that I need to search
>> through. Although the query I'm using can result to multiple rows, I
>> only need the first matching row. This query will be executed probably
>> a hundred thousand times. So I really need to optimize it
>>
>> What is the most efficient way of getting the first matching record
>> PL/SQL? and Pro*C?
>>
>> Thanks in advance.
>>
>> Please send your response to zlm101_at_psu.edu
>>
>>
>
>Why is this necessary? Is your large table de-normalized? Does it
>contain repeating data that really should be broken into parent-child
>tables? This is going to be a problem *forever*. The cursor tactic will
>work, but it seems like a design decision that will haunt you.
>--
>Frances Edelstein
>Author of "Learning Oracle Database Programming"
>Relational Business Systems
>fran_at_rbsbooks.com
>http://www.rbsbooks.com
Received on Thu Apr 17 1997 - 00:00:00 CDT

Original text of this message

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