I want to insert in federated db TABLE1, when records get inserted into
DSY.TABLEA table.
CREATE TRIGGER DSY.TRIGA AFTER INSERT ON DSY.TABLEA
REFERENCING NEW AS TriggeredRow
FOR EACH ROW MODE DB2SQL
INSERT INTO FEDSERV.TABLE1
(LOG_TIMESTAMP, USER_NAME)
VALUES (CURRENT TIMESTAMP, TriggeredRow.NAME);
SQL30090N Operation invalid for application execution environment.
Reason
code = "22". LINE NUMBER=2. SQLSTATE=25000
So then I added PROCEDURE1, but this did not help:
CREATE PROCEDURE DB2ADMIN.PROCEDURE1 ( IN NAME VARCHAR(50) )
P1: BEGIN
INSERT INTO FEDSERV.TABLE1 (LOG_TIMESTAMP, USER_NAME)
VALUES (CURRENT TIMESTAMP, NAME);
END P1
CREATE TRIGGER DSY.TRIGA AFTER INSERT ON DSY.TABLEA
REFERENCING NEW AS TriggeredRow
CALL DB2ADMIN.PROCEDURE1(TriggeredRow.NAME);
SQL0723N An error occurred in a triggered SQL statement in trigger
"DSY.TRIGA". Information returned for the error includes SQLCODE
"-20136", SQLSTATE "55047" and message tokens
"DB2ADMIN.PROCEDURE1|SQL051117152646510".
Antanas - 18 Nov 2005 08:32 GMT
A nickname cannot be an update target in a trigger. You can
include SELECT statements on nicknames in the trigger body. You cannot
include INSERT, UPDATE, or DELETE statements on nicknames in the
trigger
body.