Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / November 2005

Tip: Looking for answers? Try searching our database.

Inserting into federated DB from trigger

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Antanas - 18 Nov 2005 06:58 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.