开发者

Learning about DB2 triggers

开发者 https://www.devze.com 2023-03-08 13:37 出处:网络
开发者_如何学CHi I am trying to figure out the syntax for triggers. I have two tables one called tagged_in and the other notification. So I want to make a trigger where when an insert is called in tag

开发者_如何学CHi I am trying to figure out the syntax for triggers. I have two tables one called tagged_in and the other notification. So I want to make a trigger where when an insert is called in tagged_in I want to insert a tuple in notification.


The manuals are available at the DB2 InfoCenter. Did you read the CREATE TRIGGER statement information yet? If not, why not? If so, what did you try, and what error did you get?


Something like this

CREATE TRIGGER TEST_TRIGGER
     AFTER INSERT ON TAGGED_IN
     REFERENCING NEW AS NEW_TAG
     FOR EACH ROW
     BEGIN ATOMIC
       INSERT INTO NOTIFICATION
         VALUES (NEW_TAG.FIELD1,NEW_TAG.FIELD2);
     END
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号