日期:2014-05-17  浏览次数:20761 次

刚学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 
这句后面没加分号