Following EXAMPLE proceudre calls TO_CHAR function which is given below.
CREATE PROCEDURE EXAMPLE()
DECLARE VAR VARCHAR(254) DEFUALT ' ';
SET VAR = TO_CHAR(TIMESTAMP('20020202182727'),'DDMMYYHHMMSS' )
CREATE FUNCTION TO_CHAR(D TIMESTAMP, FMT VARCHAR(50))
On compiling the EXAMPLE procedure, following error was thrown,
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0171N The data type, length or value of argument "2" of routine
"SYSIBM.TO_CHAR" is incorrect. LINE NUMBER=6. SQLSTATE=42815.