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: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Tue, 4 May 1999 07:33:28 +0100
Message-ID: <925799891.29128.0.nnrp-13.9e984b29@news.demon.co.uk>

What about duplicate rows (which might be legal in this case) - your strategy could return less than 10 rows.

Also, as a general approach, it could require two (partial) tablescans of the table, with an undesirable overhead.

Finally, since the CBO does not guarantee mechanism, it might be possible to get
inconsistent answers: your query is defined so that the first half is supposed to find more rows than the second - what happens if the first half uses a full tablescan and the second half uses an index scan ?
In this case you could return anything between 10 rows and 20 rows.

BTW - you can use ''<=' with rownum; I always feel uncomfortable with code that uses N+1 when the target is N.

--

Jonathan Lewis
Yet another Oracle-related web site: www.jlcomp.demon.co.uk

Van Messner wrote in message ...
>This won't always work, depending on what you need to do with the rows.
But
>as a select statement you can get rows 11 to 20 by
>Select * From x Where rownum < 21
>Minus
>Select * From x Where rownum < 11;
Received on Tue May 04 1999 - 01:33:28 CDT

Original text of this message

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