?
Solved

Cursor%Rowcount shows 0

Posted on 2008-11-07
7
Medium Priority
?
1,180 Views
Last Modified: 2013-12-19
Cursor%Rowcount shows the value Zero.
SELECT command showing output but Cursor%Rowcount shows the value Zero.
0
Comment
Question by:Biju1149
  • 3
  • 3
7 Comments
 
LVL 9

Expert Comment

by:MarkusId
ID: 22903774
When do you invoke the Cursor%Rowcount - function? It won't bring back any value until you have fetched records, as it only shows the value of how many records have been fetched so far.
0
 
LVL 27

Accepted Solution

by:
sujith80 earned 2000 total points
ID: 22910694
ROWCOUNT attribute is useful in case of bulk SELECTs.
You have to use this attribute in PL/SQL code.
You mus use the actual cursor name as in <cursor name>%rowcount.

For implicit selects there is an attribute called SQL%ROWCOUNT.

See the following example.
If it doesnt help, post the portion of your code.


SQL> declare
  2   cursor c1 is 
  3   select object_id from tbl1;
  4   type t1 is table of number index by binary_integer;
  5   l_t1 t1;
  6  begin
  7   open c1;
  8   fetch c1 bulk collect into l_t1;
  9   dbms_output.put_line('No of records from cursor is : '||c1%ROWCOUNT);
 10   close c1;
 11  
 12   select object_id bulk collect into l_t1
 13   from tbl1;
 14  
 15   dbms_output.put_line('No of records fetched is : '||SQL%ROWCOUNT);
 16  end;
 17  /
No of records from cursor is : 10
No of records fetched is : 10
 
PL/SQL procedure successfully completed.
 
SQL> 

Open in new window

0
 

Author Comment

by:Biju1149
ID: 22919304
Hi sujith80

Thanks very much for your valued reply.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 27

Expert Comment

by:sujith80
ID: 22928542
Does it answer your query?
0
 

Author Comment

by:Biju1149
ID: 22928583
Sujith80:
 yes Sujith
0
 
LVL 27

Expert Comment

by:sujith80
ID: 22936447
Great. Please close the question.
0
 

Author Closing Comment

by:Biju1149
ID: 31514303
Thanks very much for the help
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to take different types of Oracle backups using RMAN.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question