Count number of rows in sys_refcursor

I want to print the number of rows gathered in sys_refcursor variable STATS.

set serveroutput on BUFFER 100000000
DECLARE
  P_param1_1 VARCHAR2(200);
  P_param1_2 VARCHAR2(200);
  STATS sys_refcursor;
BEGIN
  P_param1_1 := 'ABC';
  P_param1_2 := 'DEF';

  myPKG.myPROC(
    P_param1 => P_param1_1,
    P_param2 => P_param1_2,
    STATS => STATS
  );
END;
gram77Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
You have to open the cursor and loop through it.  There is no cursor.count type property.
0
gram77Author Commented:
when refcursor has a cursor.count property then why dosen't sys_refcursor have the same?
0
slightwv (䄆 Netminder) Commented:
Cursors do not have a count property no matter what type they are.  If you have documentation that shows this, I would love to take a look at it.

There is a ROWCOUNT inside pl/sql that shows affected rows after some DML have been processed.

You cannot get a count from a cursor until you have opened it and processed all the rows.  This is typically done with a loop counter that is incremented as you loop through the cursor.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.