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: Rownum

Re: Rownum

From: Greg Stark <greg-spare-1_at_mit.edu>
Date: 2000/06/15
Message-ID: <87r99zd5ih.fsf@HSE-Montreal-ppp138319.sympatico.ca>#1/1

"Naguib Younes" <ynaguib_at_videotron.ca> writes:

> Hi,
>
> Does anybody know how to return just a small set of data, ex record 20 to 30
> in a record set, in a select statement, i used rownum, but i soon as you do
> an order by, it stops working, i used hints, but it stop working when the
> SQL become complicated, i'm out of ideas how to fixe this,

it will work with order by as long as you're ordering by something indexed rather than sorting. Specifically, if Oracle is doing an index scan to get the records then you'll get the records you expect. If Oracle is fetching n records and then sorting you won't.

In 8i you can also sort a subquery as someone else posted which solves your problem.

-- 
greg
Received on Thu Jun 15 2000 - 00:00:00 CDT

Original text of this message

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