SQL Stored procedure passing a cursor to another SQL stored procedure

Peter Van Eeuwen

SQL Stored procedure passing a cursor to another SQL stored procedure
I am attempting to create a SQL stored procedure (SP1) that calls another SQL stored procedure (SP2).

SP2 creates a cursor which contains default address information. SP1 wants to call SP2 to append this default address information to additional information.

The environment is DB2 OS/390 version 6. DB2 connect version 7.

I was under the impress that SP1 would:
DECLARE a RESULT_SET_LOCATOR;
DECLARE the appropriate variables for the result set columns;
CALL SP2
ASSOCIATE RESULT_SET_LOCATOR with PORCEDURE SP2;
ALLOCATE resultset_cursor FOR RESULT_SET_LOCATOR
loop / FETCH till my hearts desire;
close the resultset_cursor;

Is this not a feature of DB2 OS/390? Any help would be greatly appreciated.

P. Van Eeuwen


Find the best deals on the web at AltaVista Shopping!
http://www.shopping.altavista.com



[login to unmask email]

Re: SQL Stored procedure passing a cursor to another SQL stored procedure
(in response to Peter Van Eeuwen)
I believe the cursor is uniquely defined to the executing SQL statement in
an SP (or batch program, or CICS module) and as such cannot be passed to
another executing entity. Just my opinion, which, if true, might be an
interesting concept for IBM to pursue as an enhancement...

George