[在线等]ORACLE触发器编译错误,到底是我那地方写错了?

lianxinihewoa 2004-11-01 03:23:02
以下是我写的ORACLE触发器代码,编译的时候提示有编译错误,可惜小弟看不出来,希望有经验的哥哥姐姐帮忙看下,先谢谢了

create or replace trigger hr.biud_employees_copy
before insert or update or delete
on hr.employees_copy

declare
l_action employees_log.action %type;

begin
if inserting then
l_action :='insert';
else if updating then
l_action :='update';
else if deleting then
l_action :='delete';
else
raise_application_error(-20001,'You should never ever get this error');
end if;

insert into hr.employees_log(who,action,when)values(user,l_action,sysdate);
end ;


编译提示错误:
行号= 16 列号= 11 错误文本= PLS-00103: 出现符号 ";"在需要下列之一时: if
...全文
138 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
lianxinihewoa 2004-11-01
  • 打赏
  • 举报
回复
谢谢, bzszp(SongZip)
bluelamb 2004-11-01
  • 打赏
  • 举报
回复
else if 改成elsif
否则的话 每个else if 都要有end if搭配
David1289 2004-11-01
  • 打赏
  • 举报
回复
Oracle中语法应该用 elsif 注意单词拼写
bzszp 2004-11-01
  • 打赏
  • 举报
回复
is elsif not elseif!
lianxinihewoa 2004-11-01
  • 打赏
  • 举报
回复
bzszp(SongZip) ( )

当我按照你说的把else if 修改为elseif的时候,出错信息变成了:

行号= 7 列号= 12 错误文本= PLS-00103: 出现符号 "UPDATING"在需要下列之一时: := . ( @ % ;
行号= 9 列号= 12 错误文本= PLS-00103: 出现符号 "DELETING"在需要下列之一时: := . ( @ % ;
行号= 15 列号= 46 错误文本= PLS-00103: 出现符号 "WHEN"在需要下列之一时: <an identifier> <a double-quoted delimited-identifier> 符号 "<an identifier>在 "WHEN" 继续之前已插入。
行号= 16 列号= 10 错误文本= PLS-00103: 出现符号 ";"在需要下列之一时: if
bzszp 2004-11-01
  • 打赏
  • 举报
回复
else if
改成
elsif

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧