March 11, 2010, Thursday, 69


Parameters

From SQL PL Guide for DB2

Jump to: navigation, search

Parameters

DB2 is supporting input and output parameters. Furthermore parameters which are input AND output parameter are possible. The parameters must be specified in the create statement with the keywords IN, OUT or INOUT.

The parameters are optional, that means you can create procedures without any input or output paramters. At maximum 32.767 parameters can be specified in a stored procedure.

Default values are not supported in DB2 SQL PL procedures, but there's a workaround available.

Example:

create procedure myproc (in var01 integer, out var02 integer, inout var03 varchar(20))
language sql
begin
  <procedure body>
end!


call myproc (100, ?, 'value03')