469,352 Members | 1,795 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Inserting in 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 TRIGGER DSY.TRIGA AFTER INSERT ON DSY.TABLEA
REFERENCING NEW AS TriggeredRow
CALL DB2ADMIN.PROCEDURE1(TriggeredRow.NAME);
CREATE PROCEDURE DB2ADMIN.PROCEDURE1 ( IN NAME VARCHAR(50) )
P1: BEGIN
INSERT INTO FEDSERV.OBELOGGING
INSERT INTO FEDSERV.TABLE1
(LOG_TIMESTAMP, USER_NAME)
VALUES (CURRENT TIMESTAMP, NAME);
END P1

SQL0723N An error occurred in a triggered SQL statement in trigger
"DSY.TRIGLOG". Information returned for the error includes SQLCODE
"-20136",
SQLSTATE "55047" and message tokens
"DB2ADMIN.PROCEDURE1|SQL051117152646510".
SQLSTATE=09000

How can I make it work?

Nov 18 '05 #1
0 1301

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
1 post 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
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.