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 > Procedure that returns a cursor

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-27-08, 20:17
pflarini pflarini is offline
Registered User
 
Join Date: Nov 2008
Posts: 8
Procedure that returns a cursor

Ok, I'm still having problems returning cursors from db2 procedure..

For example:
I have a procedure A, that return a cursor:

CREATE PROCEDURE A ( )
DYNAMIC RESULT SETS 1
P1: BEGIN
DECLARE cursor1 CURSOR WITH RETURN TO CLIENT FOR
SELECT handle, descricao from sam_grau;
OPEN cursor1;
END P1


And I have a procedure B that must to open procedure A and read it like a cursor.

?
How to do this ?


Thanks.
Reply With Quote
  #2 (permalink)  
Old 11-28-08, 03:09
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
__________________
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-28-08, 05:42
pflarini pflarini is offline
Registered User
 
Join Date: Nov 2008
Posts: 8
I can't see how can I use the opened cursor inside the caller procedure.
How can I do that ?
Reply With Quote
  #4 (permalink)  
Old 11-28-08, 07:15
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Since you specify the cursor as RETURN TO CLIENT, you cannot do that, of course.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #5 (permalink)  
Old 11-28-08, 07:52
pflarini pflarini is offline
Registered User
 
Join Date: Nov 2008
Posts: 8
Hi stolze, can you send me an example of how can I do this ?

Procedure A opens a cursor and procedure B use this cursor.

Thanks.
Reply With Quote
  #6 (permalink)  
Old 11-28-08, 07:54
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Yes, open the cursor WITH RETURN TO CALLER. See the manual for that.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
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