UDX input arguments

The signature of a UDX can specify both fixed-size and any-size input arguments. The Db2® database engine verifies that all arguments match the required number and data types.

For a fixed-size input argument, the Db2 database engine confirms that the size of the input value matches the size specified in the signature. If necessary, the Db2 database engine casts the input value to match the specified size. For example, if you specify CHAR(20) in the signature, the Db2 database engine:
  • Truncates an input string that is longer than 20 characters
  • Adds trailing blanks to an input string that is less than 20 characters

For an any-size argument, the Db2 database engine checks that the input value is a valid character string and that it occurs in the expected place of the signature. If necessary, the Db2 database engine casts the input value. For example, if you specify VARCHAR(ANY) in the signature but you pass an input of CHAR(200) to the UDX, the Db2 database engine casts the CHAR(200) to VARCHAR(200).