ORACLE and TRIGGERS (inserted, updated, deleted)

后端 未结 4 795
小鲜肉
小鲜肉 2020-12-14 02:00

I would like to use a trigger on a table which will be fired every time a row is inserted, updated, or deleted.

I wrote something like this:

CREATE o         


        
4条回答
  •  死守一世寂寞
    2020-12-14 02:17

    From Using Triggers:

    Detecting the DML Operation That Fired a Trigger

    If 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.

    So

    IF DELETING THEN ... END IF;
    

    should work for your case.

提交回复
热议问题