I'm trying to test a DB2 stored procedure that's running on an AS/400 system. Our company currently has the IBM System i Access for Windows installed that runs SQL commands against the DB2 database.
My big question: What is the syntax to execute a stored procedure that takes in a parameter / returns a result as an output parameter and print the value to the screen?
I'm basically trying to figure out if I can execute the procedure and see the results in the GUI tool. Thanks for all the help.
Display Results in a seperate window. <-- in/out paramenters will apear at the bottom of calling window but result sets will each be in a seperate window.
What is the syntax to execute a stored procedure that takes in a
parameter / returns a result as an output parameter and print the value
to the screen?
As Phil mentions, the syntax is the normal syntax for a SQL CALL statement. The 'Messages' pane will show OUT and INOUT parm values after a CALL successfully completes.
If the purpose is to return a value rather than a result set, you'd almost certainly be better off creating a FUNCTION than a PROCEDURE.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
Discuss This Question: 3  Replies
//in Navigator - run SQL script
//if you need to run any cl's --
CL: ADDLIBLE TESTDTA;
CL: ADDLIBLE TESTPGM;
//to call stored procedure
Call proclib.procName('Char Parm', 15, '005',003);
// So procName had 4 parameters (Char, Decimal , char, decimal)
I've got the options set to:
Display Results in a seperate window. <-- in/out paramenters will apear at the bottom of calling window but result sets will each be in a seperate window.
What is the syntax to execute a stored procedure that takes in a parameter / returns a result as an output parameter and print the value to the screen?
As Phil mentions, the syntax is the normal syntax for a SQL CALL statement. The 'Messages' pane will show OUT and INOUT parm values after a CALL successfully completes.
If the purpose is to return a value rather than a result set, you'd almost certainly be better off creating a FUNCTION than a PROCEDURE.
Tom