Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Result set positioning

Re: Result set positioning

From: Stephen Bell <stephen.bell_at_cgi.ca>
Date: Fri, 06 Jul 2001 08:03:45 -0400
Message-ID: <3B45A921.7B292C6A@cgi.ca>

Hi Daniel,

I don't think that will work because of the > 19 requirement...won't you always get zero records because as the rownums are assigned they start with 1 (which isn't >19 so reject that row..) etc...

SQL> select empno,ename
  2 from (select empno,ename,rownum
  3 from emp)
  4 where rownum >19 and rownum <40;

no rows selected

"Daniel A. Morgan" wrote:

> Francesco Rossi wrote:
>
> > Hi at all,
> > i must select a range of record from a table starting at record position x,
> > example: in a table with 100 records i must start the result set from the
> > 20th record wthout any order, such as SELECT * FROM TABLE NEXT 20.
> > How i can do this with a Select ?
> > Thank
>
> Something tells me this is a test question and you want us to do it for you ...
> but what the heck.
>
> SELECT field1, field2
> FROM (
> SELECT field1, field2, rownum
> FROM mytable)
> WHERE rownum > 19
> AND rownum < 40;
>
> Daniel A. Morgan
  Received on Fri Jul 06 2001 - 07:03:45 CDT

Original text of this message

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