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 problem...

Re: ROWNUM problem...

From: PC Automation <dullery_NOSPAM_at_us.oracle.com>
Date: Thu, 30 Apr 1998 16:24:10 -0700
Message-ID: <6ib1gm$3i5$1@inet16.us.oracle.com>


rownum is a kind of pseudo column that will only work for "<" or "<=". Since rownum is used in the where clause, there will alway be 0 rows that are greater than rownum (the first row returned will be rownum 1, but you asked for rownum > 10, so the next row is retrieved, and it becomes rownum 1 also not greater than 10 ...) Try this:

select A from AAA where rownum < 20
minus
select A from AAA where rownum <= 10
/

Let me know if it works.

Jimmy wrote in message <35498729.29C9_at_comp.polyu.edu.hk>...
>Hello all,
>
> When I type "select A from AAA" then 100 rows selected.
> Now, I want to select the first 10 records. So I type "select A from
>AAA where rownum > 0 and rownum <= 10", then 10 rows selected.
> Now, I want to select the NEXT 10 record by "select A from AAA where
>rownum > 10 and rownum <= 20", then no row selected.
>
> Could anyone tell me why no row selected? And how to select the NEXT 10
>records by a SQL statement?
>
>Thanks,
>Jimmy
Received on Thu Apr 30 1998 - 18:24:10 CDT

Original text of this message

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