◆刚学习db2,这样的触发器怎么写◆
在删除 T_QUESTION 表的记录时 同时删除T_OPTION下的相关记录
CREATE TRIGGER DB2ADMIN.T_QUT_DEL_TR
BEFORE DELETE ON DB2ADMIN.T_QUESTION
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
DELETE FROM DB2ADMIN.T_OPTION WHERE QUTID = CURRENT QUTID;
END
CREATE TRIGGER DB2ADMIN.T_QUT_DEL_TR
AFTER DELETE ON DB2ADMIN.T_QUESTION
REFERENCING OLD AS O_ROW
FOR EACH ROW MODE DB2SQL
DELETE FROM DB2ADMIN.T_OPTION WHERE QUTID = O_ROW.QUTID;