我想在表上使用一个触发器,每次插入,更新或删除一行时,它将被触发。
我写了这样的东西:
CREATE or REPLACE TRIGGER test001 AFTER INSERT OR DELETE OR UPDATE ON tabletest001 REFERENCING OLD AS old_buffer NEW AS new_buffer FOR EACH ROW WHEN (new_buffer.field1 = 'HBP00')
它的工作原理
由于我想做同样的事情,如果行被插入,更新或删除,我想知道触发器发生了什么。
我想我可以设法找到该行是否插入或更新(我可以使用new_buffer检查old_buffer)。
我怎么知道行是否被删除?
从
Using Triggers:
原文链接:https://www.f2er.com/oracle/206054.htmlDetecting the DML Operation That Fired
a TriggerIf more than one type of DML operation
can fire a trigger (for example,ON
INSERT OR DELETE OR UPDATE OF
Emp_tab),the trigger body can use the
conditional predicates INSERTING,
DELETING,and UPDATING to check which
type of statement fire the trigger.
所以
IF DELETING THEN ... END IF;
应该适合你的情况。