May 19, 2012, Saturday, 139


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 supported since DB2 9.5 in SQL PL procedures. For DB2 9 and DB2 9.5 a workaround is available.

Example:

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


call myproc (100, ?, 'value03')