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: Pull records 1000-2000 from SQL recordset

Re: Pull records 1000-2000 from SQL recordset

From: Mike Philippens <mphilipp_at_oracle-home.com>
Date: Sat, 30 Oct 1999 21:30:17 GMT
Message-ID: <s1mor9hpiqi9@corp.supernews.com>


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



Mike F.M.Philippens
Oracle-Home
E-mail mphilipp_at_oracle-home.com
Visit Oracle-Home www.oracle-home.com for the best Oracle Resources !

--
Posted via CNET Help.com
http://www.help.com/ Received on Sat Oct 30 1999 - 16:30:17 CDT

Original text of this message

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