Oracle 触发器 用before 和after的区别在哪 ?哪个都是dept和自己建立的日志表被修改啊 。
createorreplacetriggertri_deptafterinsertordeleteorupdateondeptdeclaretag_logvarchar2...
create or replace trigger tri_dept after insert or delete or update on dept
declare
tag_log varchar2(20);
begin
if inserting then
tag_log:='插入';
elsif deleting then
tag_log:='删除';
elsif updating then
tag_log:='更新';
end if;
insert into dept_log values(tag_log,sysdate);
end;
insert into dept(deptno) values(80);
select * from dept_log;
select * from dept; 展开
declare
tag_log varchar2(20);
begin
if inserting then
tag_log:='插入';
elsif deleting then
tag_log:='删除';
elsif updating then
tag_log:='更新';
end if;
insert into dept_log values(tag_log,sysdate);
end;
insert into dept(deptno) values(80);
select * from dept_log;
select * from dept; 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询