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

Oracle中存储过程的问题???
create or replace procedure myproc_3
as
  cursor mysor is select * from emp for update;
begin
  open mysor;
  for i in mysor
  loop
  if i.deptno = 10 then
  update emp set sal=(sal+500)* 3 where current of mysor;
  elsif i.deptno = 20 then
  update emp set sal=sal* 3 where current of mysor;
  else
  update emp set sal=sal-1000 where current of mysor;
  end if ;
  end loop;
  close mysor;
end;

select * from emp;
begin
  myproc_3;
end;

存储过程是成功 的,为什么运行的时候系统报错是,游标已经打开

------解决方案--------------------
我的异常网推荐解决方案:oracle存储过程,http://www.aiyiweb.com/oracle-develop/177537.html
------解决方案--------------------
用for 就不需要open/close游标了 
还有 你忘记在代码里加commit了
------解决方案--------------------
同意2L的说法!