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: Select First 500 Rows of a Table

Re: Select First 500 Rows of a Table

From: JS <nospam_at_nospam.com>
Date: Sun, 29 Aug 2004 11:41:27 -0500
Message-ID: <10j425ntgd1fif5@corp.supernews.com>


Michael wrote:

> I ideally would like to SELECT the first 500 records of a table then
> the NEXT 500 and so forth.

It sounds like you want some form of pagination. Tom Kyte has documented this well at
http://asktom.oracle.com/pls/ask/f?p=4950:8:305088716325758992::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:127412348064, and also in his latest book.

select *
  from ( select a.*, rownum rnum

           from ( YOUR_QUERY_GOES_HERE -- including the order by ) a
          where rownum <= MAX_ROWS )

 where rnum >= MIN_ROWS
/ Received on Sun Aug 29 2004 - 11:41:27 CDT

Original text of this message

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