Main Page | Report this Page
Computers Forum Index  »  Computer - Databases - IBM DB2  »  Oracle to DB2 Migration Problem - Triggers...
Page 1 of 1    

Oracle to DB2 Migration Problem - Triggers...

Author Message
jbaron...
Posted: Wed Oct 28, 2009 4:24 pm
Guest
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...
Posted: Thu Oct 29, 2009 2:44 am
Guest
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
 
 
Page 1 of 1    
All times are GMT
The time now is Sun Nov 22, 2009 4:09 pm