Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Select First 500 Rows of a Table
In article <91721cf.0408171304.50618189_at_posting.google.com>, Michael wrote:
> Hello,
>
> In Oracle 8.17 from SQLPLus how can I SELECT the first 500 rows of a
> table? I am versed in creating (filtering out) data using a WHERE
> clause - this is different than that.
>
> I ideally would like to SELECT the first 500 records of a table then
> the NEXT 500 and so forth.
>
> Thanks for your advice,
>
> Michael
First, first rows is a bit vague. There needs to be a sorting criteria.
Something like this should work:
select
x, y, z
from (
select x,y,z, ROWNUM r
from my precious_table
)
where r between 1 and 500;
See also http://www.adp-gmbh.ch/ora/sql/examples/first_rows.html
hth,
Rene
-- Rene Nyffenegger http://www.adp-gmbh.ch/Received on Wed Aug 18 2004 - 05:00:33 CDT