Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2009
    Posts
    8

    Question 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?
    Thoughts?

    Thanks!
    SkydiverMN

  2. #2
    Join Date
    Jul 2009
    Location
    NY
    Posts
    963
    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.

    Lenny K.

  3. #3
    Join Date
    Jul 2009
    Posts
    8

    yep, thanks.

    I don't know what I was thinking. I added an output param, and simply set this value based on my conditions during the processing. Works pretty slick. Thanks!

  4. #4
    Join Date
    Jul 2009
    Location
    NY
    Posts
    963
    No problem !

    Lenny

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •