17,377
社区成员
发帖
与我相关
我的任务
分享
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字段没有内容,哪里有问题?