这是我写的一个tigger 然后一直报错
38/13 PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ;
They symbol ";" was substituted fro "end-of-file" to continue.求帮看看到底哪出问题了 谢谢create or replace trigger QtyCheck1
after insert on supplyused
for each rowDECLARE
pgm_name varchar2;
pgm_qty number(4);
pgm_partid varchar2;
pgm_partqty number(4);
pgm_newqty number(4);BEGINselect partname,partinvqty into pgm_name,pgm_partqty
from part
where partid=:new.partid;select SUPPLYUSEDQUANTITY,s.partid
 into pgm_qty,pgm_partid
 from supplyused s inner join part p on s.partid=p.partid
 where supplyid=:new.supplyid;pgm_newqty:=pgm_partqty-pgm_qty;update part
set partinvqty=pgm_newqty
where partid=pgm_partid;if
pgm_newqty < 5 then
dbms_output.put_line('Item '||pgm_name||'        Useage: '||pgm_qty);
dbms_output.put_line('Warning: '||pgm_name||'has only'||pgm_newqty||'instock.');
else if
pgm_newqty >= 5 then
dbms_output.put_line('Item '||pgm_name||'        Useage: '||pgm_qty);
dbms_output.put_line('Numbers remaining: '||pgm_newqty);end if;
end if;END QtyCheck1
/

解决方案 »

  1.   

    else if --此处要分号
    pgm_newqty >= 5 then
    dbms_output.put_line('Item '||pgm_name||'        Useage: '||pgm_qty);
    dbms_output.put_line('Numbers remaining: '||pgm_newqty);end if;
    end if;
      

  2.   

    if...else...的用法:
      if exp1 then
         begin
              ... 
         end; 
        elsif exp2 then 
           begin 
             ... 
           end; 
          else 
           begin 
            ... 
           end;
    end if; 
      

  3.   

    PLS-00103 
    这个错误一般是少了分号导致的
    检查一下
      

  4.   


    找到了最后的end 少了分号找了半个多小时。万分感谢