oracle 10g创建触发器的时候出错:Warning: Trigger created with compilation errors.哪错了呢
SQL>createorreplacetriggerbiud_employees_copy2beforeinsertorupdateordelete3onemployee...
SQL> create or replace trigger biud_employees_copy
2 before insert or update or delete
3 on employees_copy
4 declare
5 l_action employees_log.action%type;
6 begin
7 if inserting then
8 l_action:='Insert';
9 elsif updating then
10 l_action:='Update';
11 elsif deleting then
12 l_action:='Delete';
13 else
14 raise_application_error(-20001,'You should nerver ever get this error.');
15 insert into emplyees_log(who,action,when)
16 values(user,l_action,sysdate);
17 end;
18 / 展开
2 before insert or update or delete
3 on employees_copy
4 declare
5 l_action employees_log.action%type;
6 begin
7 if inserting then
8 l_action:='Insert';
9 elsif updating then
10 l_action:='Update';
11 elsif deleting then
12 l_action:='Delete';
13 else
14 raise_application_error(-20001,'You should nerver ever get this error.');
15 insert into emplyees_log(who,action,when)
16 values(user,l_action,sysdate);
17 end;
18 / 展开
2个回答
展开全部
执行完上面的脚本后
show error
或者查字典
select text from dba_errors where name='BIUD_EMPLOYEES_COPY';
可以看到具体的错误
你贴一下
show error
或者查字典
select text from dba_errors where name='BIUD_EMPLOYEES_COPY';
可以看到具体的错误
你贴一下
追问
LINE/COL ERROR
-------- -----------------------------------------------------------------
14/4 PLS-00103: Encountered the symbol ";" when expecting one of the
following:
if
追答
1.没有end if; ,在raise_application_error的下一行需要end if
create or replace trigger biud_employees_copy
before insert or update or delete
on employees_copy
declare
l_action employees_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 nerver ever get this error.');
end if;
insert into emplyees_log(who,action,when)
values(user,l_action,sysdate);
end;
/
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-10-11
展开全部
你的error没有完全整出来
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询