时间:2021-07-01 10:21:17 帮助过:19人阅读
Demo Database:
Step one:Create a table to record information for TRIGGER operator.
Create TABLE dept_log( operate_tag VARCHAR2(10), operate_time DATE );
Step two:Create a trigger on table dept.
CREATE OR REPLACE TRIGGER tri_dept BEFORE INSERT ON dept DECLARE var_tag VARCHAR2(10); BEGIN IF inserting THEN var_tag:=‘i‘; ELSIF updating THEN var_tag:=‘u‘; ELSIF deleting THEN var_tag:=‘d‘; END IF; INSERT INTO dept_log VALUES(var_tag,SYSDATE); END tri_dept;
Step three:Launch a table operator in the trigger set.
INSERT INTO dept VALUES(9,‘a‘,‘a‘);
Step four:select dept_log table information
select * from dept_log;
ORACLE_TRIGGER
标签:logs tag date creat name response log span orm