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: How to return just one row after finding it

Re: How to return just one row after finding it

From: Günter Nowak <elisabeth.weisskircher_at_chello.at>
Date: Fri, 01 Oct 1999 19:08:26 GMT
Message-ID: <37F50859.BCEE7E2@chello.at>

"md_at_doc.us.dell.com" schrieb:

> Hi all,
> How would I write a query so, that it will stop searching as soon as
> it finds the first record in the table?
> The reason I would like to do that is so, the query doesn't go on and
> search for next 100,000 records for other records matching the same
> criteria. I just want the first one matching criteria and stop.
>
> For example: I want to find PartDate where PartNumber = 1000 from
> PartHistory table.
>
> Thanks in advance,
> -MD

I think

select Max(PartDate)
from PartHistory
where PartNumber=1000

is a possibility finding one record using standard SQL

select PartDate
from PartHistory
where PartNumber=1000 and RowNum=1

is another way using ORACLE specific SQL Received on Fri Oct 01 1999 - 14:08:26 CDT

Original text of this message

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