当前位置: 代码迷 >> Oracle管理 >> 刚学sql,照书上的例子建立个触发器,就报错。该怎么解决
  详细解决方案

刚学sql,照书上的例子建立个触发器,就报错。该怎么解决

热度:108   发布时间:2016-04-24 05:45:23.0
刚学sql,照书上的例子建立个触发器,就报错。
create or replace trigger overdraft after update on account referencing new as n for each row when (n.balance<0)
begin 
 insert into loan values(n.account_number,n.branch_name,-n.balance);
 insert into borrower (select customer_name,account_number from depositor where n.account_number=depositor.account_number);
 update account set balance=0 where account.account_number=n.account_number
end;/

用的是oracle10g xe,错误报告:

行 5 上出现错误: PLS-00103: 出现符号 "end-of-file"在需要下列之一时:
 begin
  case declare end exception exit for goto if loop mod null
  pragma raise return select update while with 
  <<
  close current delete fetch lock insert open rollback
  savepoint set sql execute commit forall merge pipe


------解决方案--------------------
update account set balance=0 where account.account_number=n.account_number 
这句后面没加分号
  相关解决方案