Re: LIMITING ROWS IN SELECT-STATEMENT

From: Paul Drake <paled_at_home.com>
Date: Sat, 12 May 2001 23:28:25 GMT
Message-ID: <3AFDC717.8C09967A_at_home.com>


Ergün Ugurlu wrote:
>
> hi,
> how can i limit the number of rows a select-statement retrieves?
> in other databases it's handled like this:
> select * from 'tablename' where ROWNO ?= 50
> to get 50 rows max.
>
> thanks for any help

Look into using Oracle's Analytic Functions - available in 8.1.6 and later.
You can partition your select set, order the select sets, etc.

The other method is to select from an inline view

select * From (select col2, col3, col99 from my_table order by col2)  where rownum < 50
/

hth,

Paul Received on Sun May 13 2001 - 01:28:25 CEST

Original text of this message