Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Rownum
Here's the way I've done this before:
SELECT *
FROM (SELECT table_name.*, rownum rn
FROM table_name WHERE rownum < 20)
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