首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

Oracle中存储过程的有关问题?

2013-03-26 
Oracle中存储过程的问题???create or replace procedure myproc_3ascursor mysor is select * from emp fo

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.myexception.cn/oracle-develop/177537.html
[解决办法]
用for 就不需要open/close游标了 
还有 你忘记在代码里加commit了
[解决办法]
同意2L的说法!

热点排行