create table emp_bak as select * from emp;create table emp_log(
who varchar2(30),
when date,
action varchar2(20)
);
Create or replace trigger biud_emp_copy
Before insert or update or delete On emp_bak
Declare
l_action emp_log.action%type;
Begin
if inserting then
l_action := 'Insert';
elsif updating then
l_action := 'Update';
elsif deleting then
l_action := 'Delete';
else
raise_application_error(-20001,
'You should never ever get this error.');
Insert into emp_log
(Who, action, when)
Values
(user, l_action, sysdate);
End if;
end;
insert into emp_bak( EMPNO, ENAME, JOB, HIREDATE, SAL)
values(20,'song','Manager',sysdate,20000);--insert into 或者update操作后发现emp_log表中action字段没有内容,哪里有问题?谢~~~~~
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货