Unanswered: Count values returned from stored procedure?
I have a DB2 stored procedure that returns a dataset (opened and returned cursor) of a buncha rows. It's now become necessary to determine the number of rows returned. Is there an easy way to handle this?
My logic here is invalid, but hopefully you'll get the point that I'm trying to accomplish:
select count(*) from DBName.STOREPROCEDURENAME;
Can it be that simple? Do you have any examples?
You have to create the SP with integer output parameter. Could be in-out, too.
Then find the number of rows inside of the SP, before open cursor to return.
Put this number in the output parameter, then you can continue with your SP in the regular way.