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 > fire trigger after update on multiple columns in a table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-03-05, 06:59
thaiching thaiching is offline
Registered User
 
Join Date: Oct 2003
Posts: 3
fire trigger after update on multiple columns in a table

Hi all,
Is it possible to create a single trigger to fire, upon update on multiple columns in a table, instead of a single column?
For example, to fire a trigger upon update on a single column in table A, i have the following statements:

create trigger trigger1
after update of column1 on tableA
...
....


how abt if there are a few columns in tableA which needs to fire the same trigger, if there is an update to those columns? Is it possible to put into a single trigger as follow?

create trigger trigger1
after update of column1, column2 column3 on tableA
...
....

Really appreciate for any replies. Thanks.
Reply With Quote
  #2 (permalink)  
Old 10-03-05, 09:27
urquel urquel is offline
Registered User
 
Join Date: Aug 2004
Posts: 330
Yes you can do this. Note that the trigger will fire if the update statement references any of the columns, even if they are being updated to the same value. You may want to consider evaluating the transition variables in the WHEN clause to detect whether the columns are actually being updated to new values.
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