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: number of rows in cursor?

Re: number of rows in cursor?

From: Sybrand Bakker <gooiditweg_at_sybrandb.verwijderdit.demon.nl>
Date: Sat, 11 Dec 2004 10:55:56 +0100
Message-ID: <vuglr01k71k5mjdv5b42fjcpaqbedfp9to@4ax.com>


On Fri, 10 Dec 2004 15:14:28 +0100, Frank Piron <empty_at_zero.nil> wrote:

>>> You may count the rows explicitly before entering the loop.
>>>
>>> if the cursor statement is: select <projection-clause>
>>> from ....
>>>
>>> you may count with: select count(rowid) into <counter_var>
>>> from ....
>>>
>>> where <counter_var> is some local variable into which you may
>>> store the number of rows the cursor will retrieve.
>>>
>>> --
>>> Frank Piron,
>>> defrankatkonaddot
>>> (leftrotate two)
>> Except the number could change from count to the fetch of the data.
>
>Sure. But this is inevitable.
>
>--
>Frank Piron,
>defrankatkonaddot
>(leftrotate two)

As your advice also effectively selects the data twice, and consequently consumes twice as much resources, I wouldn't recommend this 'workaround' to anyone.

--
Sybrand Bakker, Senior Oracle DBA
Received on Sat Dec 11 2004 - 03:55:56 CST

Original text of this message

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