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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Rownum

Re: Rownum

From: Alton Ayers <altona_at_ditw.com>
Date: Tue, 04 May 1999 07:57:55 -0400
Message-ID: <372EE0C2.40878200@ditw.com>


Here's the way I've done this before:

SELECT *
  FROM (SELECT table_name.*, rownum rn

          FROM table_name
         WHERE rownum < 20)

 WHERE rn > 10
/

Sue French wrote:

> Can anyone help me with Rownum?
>
> For an intranet application, I need to fetch say 10 records. I can do this
> by specifiying "WHERE ROWNUM < 11".
>
> However, I then want to fetch either the next ten or the previous 10 rows.
> I thought I would be able to say "WHERE ROWNUM > 10 and ROWNUM < 20", but
> this returns no rows.
>
> I have to avoid using cursors, because this is causing no end of problems,
> so I really need to connect to the database, fetch the 10 records then
> disconnect and subsequently connect and disconnect when the next/previous 10
> are requested.
>
> Regards
>
> Sue French
> ______________________________________________________
> Visit me at http://homepages.tcp.co.uk/~sfrench/
> See you there!
Received on Tue May 04 1999 - 06:57:55 CDT

Original text of this message

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