tarun_bhardwaj
New User
Joined: 18 Jul 2003 Posts: 39 Location: delhi
|
|
|
|
Hello,
I am looking for clarity on a particular scenario regarding nesting of stored procedures. Suppose I have made 2 SQL stored procedures (say SP1 and SP2) for DB2 on Z/OS for inserting data in 2 different tables with 2 columns each (say Col1 and Col2 for Table1 and Col3 and Col4 for Table2). Now, from my java code, instead of calling the stored procedure twice, I want to pass data for all the four columns using a sigle API call (via another stored procedure, say SP3) in order to reduce the IO by having a single API call.
The skeleton of SP1 and SP2 is something like
CREATE SP1
(Col1 CHAR(4), Col2 CHAR(4))
LANGUAGE SQL
MODIFIES SQL DATA
INSERT INTO Table1
(Col1, Col2)
VALUES
(Col1, Col2);
CREATE SP2
(Col3 CHAR(4), Col4 CHAR(4))
LANGUAGE SQL
MODIFIES SQL DATA
INSERT INTO Table1
(Col3, Col4)
VALUES
(Col3, Col4);
So what should be the structure of SP3 that I need to create? Is it something like:
CREATE SP3
(
Col1 CHAR(4),
Col2 CHAR(4),
Col3 CHAR(4),
Col4 CHAR(4)
)
Call SP1(Col1, Col2)
Call SP1(Col3, Col4)
Could some one please validate if Iam proceeding in the right direction?
Thanks in advance! |
|