Oracle Database multi-event triggers, to determine the specific event in the Trigger Body, as an example:
1 create or replace trigger secure_emp 2 before 3 insert or update or delete on cux_employees 4 5 begin 6 if (to_char(SYSDATE,'DY') IN ('星期六','星期日')) or (to_char(SYSDATE,'HH24') NOT BETWEEN '08' AND '18') then 7 if deleting then 8 raise_application_error(-20502,'You may delete from EMPLOYEES table only during business hours.'); 9 elsif inserting then 10 raise_application_error(-20500,'You may insert into EMPLOYEES table only during business hours.'); 11 elsif updating('salary') then 12 raise_application_error(-20503,'You may update SALARY only during business hours.'); 13 else 14 raise_application_error(-20504,'You may update EMPLOYEES table only during normal hours.'); 15 end if; 16 end if; 17 end;