Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Limiting the resultset returned from a SELECT to the first N rows?
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)
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