Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2002
    Location
    Wisconsin
    Posts
    37

    Unanswered: Odd stored procedure question.

    I have a Java function that invokes a DB2 stored procedure and expects a result set from a cursor. My problem is I want to do some other processing in that stored procedure, so I need to look at each row fetched, which doesn't work very well in a COBOL stored procedure with the cursor declared "FOR RETURN". If I don't declare the cursor this way, it returns a single result. I could build the entire result set in an array in the stored procedure, but it would be formatted wrong for Java to handle as a result set. I have seen similar samples using DB2 temporary tables, but the overhead of using them is prohibitive.

    Does anyone know a way to accomplish this? What if I don't want to do any DB2 SQL in the stored procedure at all, I just want Java to think I did? If you have a way to do this that requires more time and effort than just a simple answer here, I can get you some compensation.

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    i don't understand the question - you can declare the cursor with return - and do work in the proc - all that has not been fetched will be fetched when back in caller program and declared the cursor on this return..
    see here for some details
    ALLOCATE CURSOR statement
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Sep 2002
    Location
    Wisconsin
    Posts
    37
    The Allocate cursor and associate locator functions are in the calling program. How does that work when Java JDBC is invoking the stored procedure?
    Last edited by Balr14; 11-17-10 at 12:39.

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

Posting Permissions

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