Hi,
I am new to the db2 world.
How do you handle exceptions within triggers.
I was trying to port following trigger from Oracle:
CREATE TRIGGER DB2ADMIN.TEST_ARI
AFTER INSERT ON DB2ADMIN.TEST
REFERENCING NEW AS NEW
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
insert into SYSTEM_LOG (error_id, error_message) values ('1', 'Hello
there. Record id#: ' || NEW.id);
EXCEPTION WHEN OTHER THEN
insert into SYSTEM_LOG (error_id, error_message) values ('1', 'ERROR
FOR id#: ' || NEW.id);
END;
END:
It complains about the EXCEPTION WHEN OTHER line.
I was wandering if this is allowed in DB2 at all. If not what is the
alternative to capturing the exception within a trigger.
I have replication going on between SQL2000 and DB2. Once a record is
replicated to DB2, trigger is fired to insert/update some other
tables. If there is an exception in the trigger it kills entire
replication. I want to capture it and log it and then continue
replicating.
Please help.
Thanks,
Tzar