DB2® supports the use of input, output, and input and output parameters in SQL procedures. The IN, OUT, and INOUT keywords in the CREATE PROCEDURE statement indicate the mode or intended use of the parameter. IN and OUT parameters are passed by value, and INOUT parameters are passed by reference.
When working with C and C++ applications, you can call an INOUT_PARAM stored procedure by using the following statement:
EXEC SQL CALL INOUT_PARAM(:inout_median:medianind, :out_sqlcode:codeind,
:out_buffer:bufferind);
In the previous statement inout_median, out_sqlcode, and out_buffer are host variables and medianind, codeind, and bufferind are null indicator variables.
C and C++ embedded SQL applications can call stored procedures by using an anonymous block when the PRECOMPILE option COMPATIBILITY_MODE is set to ORA.
>>-EXECUTE BEGIN--procedure-name--------------------------------> >--+----------------------------+--END; END-EXEC;-------------->< | .-,----------------. | | V | | '-(------| argument |---+--)-' argument |--+--------------------+--+-expression-+-----------------------| '-parameter-name--=>-' +-DEFAULT----+ '-NULL-------'
You can only specify a named argument once (implicitly or explicitly).
Named arguments are not supported on a call to an uncataloged procedure.
Named arguments correspond to the same named parameter, regardless of the order in which arguments are specified.
The DEFAULT keyword is used in the CREATE PROCEDURE statement if you have specified it; otherwise the null value is used as the default.
If the NULL keyword is specified, the null value is passed as the parameter value.