Re: Limitting number of rows returned from a select.

From: Naresh Ramamurti <nramamur_at_worldnet.att.net>
Date: 1996/06/15
Message-ID: <31C273F0.CBA_at_worldnet.att.net>#1/1


Bryan Grenn wrote:
>
> All,
>
> We have a customer who is converting from RDB to Oracle. In
> RDB they can limit the select to retrieve say the first 200
> rows through part of the select clause.
>
> Is there any way to do this in an Oracle Select clause,
>
> and
> In what versions is this available (if it is )?

Sure... You can use the ROWNUM pseudocolumn to limit the number of rows returned by a query.

e.g

select * from <table_name>
where ROWNUM < 200 .

This will return the first 200 rows.
I'm pretty sure this functionality is supported in all versions subsequent to 7.0 (including 7.0). I think v6 also supports this.

However your customer needs to keep in mind that conditions testing for ROWNUM values greater than 1 are always false and will not return any rows.

Naresh. Received on Sat Jun 15 1996 - 00:00:00 CEST

Original text of this message