If i take this example:
--DROP PROCEDURE proc1;
CREATE PROCEDURE proc1()
LANGUAGE SQL
BEGIN
DECLARE varInput INTEGER;
DECLARE varOutput INTEGER;
SET varInput = 2;
CALL proc2(varInput, varOutput);
END
;
--DROP PROCEDURE proc2;
CREATE PROCEDURE proc2(IN myInputVariable INTEGER,
OUT myOutputVariable INTEGER)
LANGUAGE SQL
BEGIN
SET myOutputVariable = myInputVariable + 5;
END
;
When i run this I get error:
21:01:22.836 DBMS MODEL0 -- Error: [IBM][CLI Driver][DB2/NT] SQL0440N
No authorized routine named "PROC2" of type "PROCEDURE" having compatible
arguments was found. LINE NUMBER=11. SQLSTATE=42884
Can you please tell me how you write the statement below?
EXECUTE IMMEDIATE CALL .... USING
An important question i have: If the procedure statement has Input and
Output parameters
CALL proc2(varInput, varOutput);
will the values of the parameters exist in the scope of the calling
procedure,
in this case proc1?
Thank you
"Serge Rielau" <sr*****@ca.ibm.com> wrote in message
news:3a*************@individual.net...
serge wrote: I can not create a stored procedure that calls another not yet created
stored procedure?
In MS SQL I get a warning that the calling procedure does not exist but
the new stored
Procedure gets created anyhow. I believe Oracle works similarly.
I can not make this possible in DB2?
Sure you can, just use a dynamic statement:
EXECUTE IMMEDIATE CALL .... USING
Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab