By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,610 Members | 2,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,610 IT Pros & Developers. It's quick & easy.

Proc1 result set with proc2

P: n/a
Hello

DB2/NT 8.1.6
Stored procedure Proc1 (SQL) return result set.
How can I call Proc1 in Proc2(SQL) and scroll on Proc1 result set? "DECLARE
CURSOR FOR CALL..." don't work. Any other statement?

DROP TABLE t1 @
CREATE TABLE t1(c1 integer, c2 varchar(10)) @
INSERT INTO t1 VALUES (1, 'aaa') @
INSERT INTO t1 VALUES (2, 'bbb') @

DROP PROCEDURE p1@
CREATE PROCEDURE p1()
DYNAMIC RESULT SETS 1
LANGUAGE SQL
BEGIN
DECLARE cur1 CURSOR WITH RETURN TO CALLER FOR
SELECT c1, c2 FROM t1;

OPEN cur1;
END@

DROP PROCEDURE p2@
CREATE PROCEDURE p2
DYNAMIC RESULT SETS 1
LANGUAGE SQL
BEGIN
-- CALL p1; ????
-- I need open P1, do something with each row and close cursor

END@

Thanks in advance
Yaro
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Take a look at result set locators (ALLOCATE and ASSOCIATE)

Cheers
Serge
Nov 12 '05 #2

P: n/a
> Take a look at result set locators (ALLOCATE and ASSOCIATE)

Thank you for hint.

Yaro

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.