Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Extracting a piece of a cursor
Scott Mattes wrote:
> Maybe something like
>
> select *
> from ( select rownum row, table.*
> from table ) a.
> where a.row between 1000 and 1100;
>
> "Francesco M." <fmarchioniNIENTESPAM_at_libero.it> wrote in message
> news:UK49a.176847$ZE.5303458_at_twister2.libero.it...
>
>>Hi all Oracle Users, >>I need to write a Stored Procedure that extract >>a "piece" of a large resultset. Let's say I want to retrieve >>from record n. 1000 to record n. 1100 of a Table. What's the >>best way (for performance and less impact on the db) >>to do it in PL/SQL ?
Of course, how could ever know what your result set would be. You cannot count on the same set of rows being returned in the same sequence every time. If my query scans the table and I later insert a row into a block on the free list then that row will now become part of my result set and change what is returned from the query. Even if you sort the output before adding the rownum pseudo column then you still can get a different result set. Perhaps you need to rethink what you are trying to accomplish.
-- AjAReceived on Tue Mar 04 2003 - 12:09:21 CST