Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Oracle to DB2 Migration Problem - Triggers

11 views
Skip to first unread message

jbaron

unread,
Oct 28, 2009, 12:24:29 PM10/28/09
to
Hi list, we are experiencing a complex migration from Oracle to DB2
9.7 in
compatibility mode using DB2 DATA MOVEMENT TOOL.

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

mirof007

unread,
Oct 28, 2009, 10:44:49 PM10/28/09
to
Hi, since this is a simple BEFORE INSERT trigger, I think you can skip
the IF INSERTING condition check altogether. It's only useful in a
multi-action trigger (INSERT OR UPDATE).

Regards,
Miro

0 new messages