469,359 Members | 1,638 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,359 developers. It's quick & easy.

Inserting into federated DB from trigger

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".

Nov 18 '05 #1
1 2762
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.

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Joerg Ammann | last post: by
3 posts views Thread by Terry | last post: by
1 post views Thread by RdR | last post: by
4 posts views Thread by uthuras | last post: by
reply views Thread by Antanas | last post: by
2 posts views Thread by mas5 | last post: by
4 posts views Thread by Praveen_db2 | last post: by
9 posts views Thread by mitek | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.