When migrating triggers one of the most typical errors we get is
this:
CREATE OR REPLACE TRIGGER "GIMS_C1_FN"."TRG_ASIGNAR_NUM_REG_TT_Q34"
BEFORE INSERT ON TT_Q34_REGISTRO
FOR EACH ROW
BEGIN
IF INSERTING THEN
IF :NEW.NUM_REG IS NULL THEN
SELECT NVL(MAX(NUM_REG),0) + 1
INTO :NEW.NUM_REG
FROM TT_Q34_REGISTRO;
END IF;
END IF;
END;
====================================
====================================
SQL Error Code = -104
Object Type = TRIGGER
Object Name = TRG_ASIGNAR_NUM_REG_TT_Q34
Schema = GIMS_C1_FN
Line Num = 7
Message = SQL0104N An unexpected token "THEN" was found
following "IF INSERTING". Expected tokens may include:
"<interval_qualifier>".
SQL0104N An unexpected token "<token>" was found following "<text>".
Expected tokens may include: "<token-list>".
Explanation:
A syntax error in the SQL statement or the input command string for
the
SYSPROC.ADMIN_CMD procedure was detected at the specified token
following the text "<text>". The "<text>" field indicates the 20
characters of the SQL statement or the input command string for the
SYSPROC.ADMIN_CMD procedure that preceded the token that is not valid.
As an aid, a partial list of valid tokens is provided in the SQLERRM
field of the SQLCA as "<token-list>". This list assumes the statement
is
correct to that point.
The statement cannot be processed.
User response:
Examine and correct the statement in the area of the specified token.
sqlcode: -104
sqlstate: 42601
================================================
================================================
Does anybody know any workaround for this problem ?
Thanks in advance.
Raul Baron
Regards,
Miro