PL/SQL Developer调试与存储过程编译错误:PLS-00103: Encountered the symbol “(“ when expecting one of the followin

1.PL/SQL Developer调试

在存储过程名称上右键选择Edit:

PL/SQL Developer调试与存储过程编译错误:PLS-00103: Encountered the symbol “(“ when expecting one of the followin_第1张图片

弹出调试窗口,和存储过程编译错误信息: 

PL/SQL Developer调试与存储过程编译错误:PLS-00103: Encountered the symbol “(“ when expecting one of the followin_第2张图片

 

2.原因分析

上述报错原因在于存储过程的入参和出参都不能指定大小和错误使用关键字declare,修改后正确代码如下:

create procedure BranchBalanceSum(s_date in char)
as
all_balance number;
v_bran_no varchar2(10);
v_bran_name varchar2(30);
cursor c_sum_bal is
select open_branch_no,open_branch_name,sum(a_bal)
from accounts group by open_branch_no,open_branch_name;
begin
  open c_sum_bal;
  loop
    fetch c_sum_bal into v_bran_no,v_bran_name,all_balance;
    if c_sum_bal%notfound then       --未找到记录
      exit;
    end if;
    insert into branch_sum
    values(v_bran_no,s_date,v_bran_name,all_balance);
  end loop;
  close c_sum_bal;
  commit;
  exception   --异常处理
  when others then
    rollback;
end;


 

 

你可能感兴趣的:(sql,数据库)