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 > Calling a procedure from another Procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-12-05, 10:08
mphilip mphilip is offline
Registered User
 
Join Date: Nov 2003
Posts: 12
Question Calling a procedure from another Procedure

Hi;
We're running "DB2 OS/390 7.1.1" and I would like to call a procedure from another procedure?

I wrote a procedure as follows but it doesn't return the values from the second procedure; it does return the values from the first procedure. Please help me out.

thanks in advance.


CREATE PROCEDURE MYSCH.SPROCTEST1
(
IN empId INTEGER
)
RESULT SETS 1
LANGUAGE SQL
COLLID DB2T
WLM ENVIRONMENT DB2TENV
SECURITY USER
RUN OPTIONS ''

P1: BEGIN

DECLARE DB2_SP_SQL1 CURSOR WITH RETURN FOR
SELECT * FROM MYSCH.EMP
WHERE EMP_ID =empId ;

-- Calling the Second Procedure
CALL MYSCH.SPROCTEST2;

OPEN DB2_SP_SQL1;

END P1
@
-- Grant access privilages to stored procedure
GRANT EXECUTE ON PROCEDURE MYSCH.SPROCTEST1 TO PUBLIC
@
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