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: Limiting the resultset returned from a SELECT to the first N rows?

Re: Limiting the resultset returned from a SELECT to the first N rows?

From: Tim Hall <tim.hall_at_spam.begone>
Date: 1997/10/28
Message-ID: <3455cb87.8861878@69.0.9.9>#1/1

Michael G. Schneider wrote:
>>
>> I would like to write a SELECT statement and limit the number of returned
>> rows. Something like
>>
>> SELECT * FROM tbl ORDER BY amount TOP 10
>>
>> Is this possible?
>>

 "H. Fellinghauer" wrote:

>Try the following:
> SELECT * FROM tbl WHERE rownum < 10 ORDER BY amount;
>

Unfortunately that won't work, since it applies the ROWNUMS before it sorts the records.

One way to do it would be to only FETCH the first 10 rows returned by the cursor (in PL/SQL)



Tim Hall, Indus International (was TSW International)

http://www.tswi.com
http://www.indusgroup.com

Replace domain name with the domain from the first URL before replying via email! Received on Tue Oct 28 1997 - 00:00:00 CST

Original text of this message

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