请问怎么将游标指针再次指向结果集首行
大家好,最近正在学习oracle 有个问题想请教下比如我想实现下面一个功能
每月工资总额不多于100000元,现在为每一位员工增长工资,比如先都增长10%,如果增长后还不到100000元,继续将游标指针再次指向结果集首行,继续遍历,我想请问怎么将游标指针再次指向结果集首行?
谢谢了
vTemp number := 0;
begin
while vTemp = 0
loop
declare
cursor cur_sal is select sal from emp order by sal for update of sal;
vSum number;
begin
for dz in cur_sal
loop
select sum(sal) into vSum from emp;
if (vSum + dz.sal*0.2) <= 100000 then
update emp set sal = sal * 1.2 where current of cur_sal;
else
vTemp := 1;
exit;
end if;
end loop;
end;
--exit when vTemp = 1;
end loop;
end;
这是我根据题目写的代码 可总是死循环 请大家帮忙看看是哪里的问题
页:
[1]
