|
|
|
|
|
|
Re: How do I get the total row count within the cursor [message #243050 is a reply to message #242971] |
Tue, 05 June 2007 16:23 |
|
BlackSwan
Messages: 26766 Registered: January 2009 Location: SoCal
|
Senior Member |
|
|
>Basically I'm trying to find if the current record is the last record in the cursor
IMO, that is essentially unanswerable.
You only KNOW for sure any record is the "last record" after trying to get the "next" record & discovering that no more records exist.
By then it is no longer the "current" record but the most recent previous record.
[Updated on: Tue, 05 June 2007 16:23] by Moderator Report message to a moderator
|
|
|
|
Re: How do I get the total row count within the cursor [message #243073 is a reply to message #243041] |
Tue, 05 June 2007 23:13 |
|
Michel Cadot
Messages: 68718 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Yes, the doc (PL/SQL User's Guide and Reference, Chapter 6 Performing SQL Operations from PL/SQL, section Managing Cursors in PL/SQL, subsection Implicit Cursors) stated:
Quote: | Implicit cursor attributes return information about the execution of DML and DDL statements, such INSERT, UPDATE, DELETE, SELECT INTO, COMMIT, or ROLLBACK statements. The cursor attributes are %FOUND, %ISOPEN %NOTFOUND, and %ROWCOUNT.
|
and
Quote: | %ROWCOUNT yields the number of rows affected by an INSERT, UPDATE, or DELETE statement, or returned by a SELECT INTO statement.
|
This seems to imply that it does not work for an implicit cursor loop.
Regards
Michel
|
|
|
|
|
|
Re: How do I get the total row count within the cursor [message #243153 is a reply to message #243133] |
Wed, 06 June 2007 04:39 |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
What makes you think adding a lead would force all rows to be retrieved? Is that because of the need for an order by?
Besides, functionality is more important than performance (IF the functionality really is needed)
Same functionality could be gained by storing the fetched row and handling the previous row in your cursor-for loop
Then after the loop handle the last row.
[Updated on: Wed, 06 June 2007 04:41] Report message to a moderator
|
|
|
|
|
|
|
|
|