Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Pull records 1000-2000 from SQL recordset
Scott Cooper wrote:
> I have a query that is pulling 5000 records back from Oracle, but I may
> only be interested in records 1000-2000 at the moment (may want to work
> with any subset, just using this as an example). I have an order by
> clause in the query, and I want the 1000-2000 recordset to be taken
> AFTER the sort. Can I achieve this in SQL, or do I have to process the
> recordset outside of SQL?
Scott,
if you don't care what subset of the resultset you get, just add an extra WHERE ROWNUM < 2000 to your query. This will do the trick. Note that you can only do less than (<) not greater than with ROWNUM. It is in fact a virtual revord number that is given to the result dataset. It is not the actual record number in the database. That is called a rowid in Oracle and is not usefull for this purpose.
Kind regards
Mike Philippens
--
Posted via CNET Help.com
http://www.help.com/
Received on Sat Oct 30 1999 - 16:30:17 CDT