Anyone could tell me what´s wrong with my function ? (It´s the first one that I´m doing.I´m trying to migrate from Oracle to DB2).
CREATE FUNCTION LPADN(P_COLUNA integer, P_TAMANHO smallint, P_CARACTER CHAR(1))
NO EXTERNAL ACTION
DECLARE V_COL varchar(30);
DECLARE V_TAM bigint;
IF P_COLUNA IS NULL OR P_TAMANHO IS NULL OR P_CARACTER IS NULL THEN
SET (V_TAM, V_COL) =( LENGTH(P_COLUNA) - 1, P_CARACTER) ;
WHILE V_TAM < P_TAMANHO DO
set V_COL = P_CARACTER||V_COL;
set V_TAM = V_TAM + 1;
set V_COL = V_COL||P_COL;
I´ve got the error:
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token ")" was found following "RE V_COL varchar(30".
Expected tokens may include: "END-OF-STATEMENT". LINE NUMBER=8.