The data type for an INOUT constant argument is governed by the data type of the value passed in, not what is defined. If the data type of the value passed in is smaller than the data type defined in the CREATE PROCEDURE or REPLACE PROCEDURE statement, and the external stored procedure returns a value larger than the maximum value of the data type for the value passed in, the system returns an overflow error.
For example, consider an external stored procedure that defines an INTEGER INOUT parameter:
CREATE PROCEDURE inout_example( INOUT p1 INTEGER ) LANGUAGE C NO SQL PARAMETER STYLE SQL EXTERNAL;
If you call the external stored procedure with a constant input value that fits into a SMALLINT, the system returns an overflow error if the output value is larger than 32767, the maximum value of a SMALLINT:
CALL inout_example(1000);