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: Getting the first matching record???

Re: Getting the first matching record???

From: Leandro Meinhardt <meinhard_at_methodus.com.br>
Date: 1997/04/14
Message-ID: <01bc48d3$5059e820$27f7f6c8@AvalonSP.sao.nutecnet.com.br>#1/1

Try to use cursors to do the job for you.

Try this SQL statement:

Declare cursor cur1 is
select col1 from tab1 order by 1;

begin

open cur1;

fetch cur1 into var1; -> this will be the first record of your set

close cur1;

end;

Any question,

My email address is meinhard_at_methodus.com.br.

Z. Martinez <zlm101_at_psu.edu> escreveu no artigo <334bd241.9605767_at_news.cac.psu.edu>...
>
> 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
>
>
>
  Received on Mon Apr 14 1997 - 00:00:00 CDT

Original text of this message

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