If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 trigger

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-25-05, 09:46
pierrewhy pierrewhy is offline
Registered User
 
Join Date: Jan 2005
Posts: 1
DB2 trigger

My first trigger.
1) I want to keep track of all Add, Update and Delete of a DB2 Master file by sending some info to others DB2 files. My trigger is set for After for all 3 instances. If I do a Delete should the record going to my new DB2 be blank? Should it be blank if I also set the Trigger for Before?
The trigger start an RPGILE program that check for TEVENT. I was hoping that the DELETE would populate the new file with the records being deleted without having to verify for the TEVENT and select the OLD_RECORD.
2) If my master is being updated from different application, is a trigger the best way to keep track of changes being made to it?
3) Can the trigger be started at a specific time of day. (once a day)
Thank you.
Reply With Quote
  #2 (permalink)  
Old 01-28-05, 00:14
jacampbell jacampbell is offline
Registered User
 
Join Date: Jan 2005
Posts: 191
1a) A trigger can be for update, insert **OR** delete - not all three. You need three triggers - note the plural.
1b) on a delete trigger use REFERENCING OLD; on a new trigger use REFERENCING NEW; what do you want to do with an update trigger?
2) a trigger is the only way to be certain of capturing all changes.
3) a trigger is fired when the alteration occurs; you can't pospone it to some later time. You can, however, use the trigger to populate a "to be processed" table and then process that table at a later time.

James Campbell
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On