If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Odd stored procedure question.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-15-10, 13:36
Balr14 Balr14 is offline
Registered User
 
Join Date: Sep 2002
Location: Wisconsin
Posts: 37
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.
Reply With Quote
  #2 (permalink)  
Old 11-16-10, 02:10
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
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
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #3 (permalink)  
Old 11-17-10, 11:28
Balr14 Balr14 is offline
Registered User
 
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 11:39.
Reply With Quote
  #4 (permalink)  
Old 11-17-10, 13:30
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On