Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Triggers

Status
Not open for further replies.

lynchdog

MIS
Jan 30, 2002
16
0
0
US
Is it possible to create a trigger that will upon update/delete/insert to a row send data to another database? My company is looking to use a trigger for this instead of replication because they believe that a trigger reacts faster than replication. Is this true? And if anyone has any ideas about the trigger please let me know.

Thanks in advance for you help!

Josh
 
I have done triggers on UDB 7.1 for OS/390 from one table to another table in the same Database. However, I am having a problem when the triggering table contains a timestamp column or a smallint column. When I try to create the trigger it gets a -189 sqlcode.

E.g. of a create trigger for update

create NameOfTrigger
after update on TblName
referencing OLD as OLD
begin atomic
insert into NewTblName
(columns of NewTblName)
values (OLD.columns of TblName);
end:

If you need me to post real examples of triggers for delete and insert I will on Monday.

If anyone knows why the timestamp and smallint columns in the trigger table makes DB2 want to perform a CSID conversion and no such conversion routine exists in the SYSSTRINGS table please let me know.
 
I understand how to setup a trigger to move data around with the local database. What I would like to try is a trigger that when set moves the data to another database on another machine.
 
Hello,

I would suggest a possible way to do that is to use federated databases. This feature of DB2 UDB allows to create nicknames that refer to objects in remote databases.
So the trigger can insert, update, delete in tables that are in other databases.
I hope it will be helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top