读书人

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

发布时间: 2013-03-26 21:09:08 作者: rapoo

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的说法!

读书人网 >oracle

热点推荐