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: Selecting a range of records

Re: Selecting a range of records

From: Galen Boyer <galenboyer_at_hotpop.com>
Date: Sat, 21 Jul 2001 21:32:19 GMT
Message-ID: <wkk81j6ycb.fsf@msn.com>

On Sun, 8 Jul 2001, gjlinker_at_oraxcel.com wrote:

> You can execute e.g. select * from emp where rownum between 10
> and 30. Note that you will get an arbitrary set of 20
> records!. To be more precise use order by.

It isn't as simple as this. A between is implicitly > x and < y. The > x will make the use of rownum not find anything.

He needs to do what Tom Kyte posted in misc. His snippet was like this

select ename, empno
from ( select emp.* , rownum R

           from emp
            where rownum <= 10 )

 where r >= 5

So, Abel would want to do

select whatever.*
from (select whatever.*, rownum R

     from whatever
     where rownum < 112)

where R >= 32
-- 
Galen
I don't want to be the rock.  Yeah, okay, what do you want to be?
I want to be the piece of glass.
Received on Sat Jul 21 2001 - 16:32:19 CDT

Original text of this message

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