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: how to retrieve records from mth to nth rows in order form?

Re: how to retrieve records from mth to nth rows in order form?

From: TurkBear <johng_at_mm.com>
Date: Mon, 27 Dec 1999 18:22:08 GMT
Message-ID: <3867ad15.4247557@super.news-ituk.to>

In earlier versions this may work for you:

select * from tablename where rownum < nth minus
select * from tablename where rownum < mth

In other words, get the top number you want ( nth) and remove those below the lower bound ( mth)

the following:

select * from tablename where rownum < 101 minus
select * from tablename where rownum < 50

should return rownums 50 to 100

Hope it helps,

Kari Marttila <Kari.Marttila_at_tieto.com> wrote:

>Hi!
>
>Is there any way to do the same in previous versions of Oracle (Oracle
>8.0.3)?
>
>Thomas Kyte wrote:
>> ...
>> In Oracle8i, release 8.1 (and not before -- this query works in 8.1.5 and up)
>> you can:
>>
>> select *
>> from (select a.*, rownum R
>> from ( select *
>> from tablename
>> order by whatever ) a
>> where rownum <= MAX_ROW_YOU_WANT
>> )
>> where R >= MIN_ROW_YOU_WANT;
>>

  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------    http://www.newsfeeds.com The Largest Usenet Servers in the World! ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==----- Received on Mon Dec 27 1999 - 12:22:08 CST

Original text of this message

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