declare
cursor c1(dno myemp.deptno%type)
is select * from myemp t where t.deptno = dno;
prec myemp%rowtype;
begin
open c1(10);
loop
fetch c1 into prec;
update myemp t set t.sal=(t.sal+1000) where t.empno = prec.empno;
exit when c1%notfound;
end loop;
close c1;
commit;
end;
--通过oricle那个emp表返回的结果,一共有三个部门为10的员工,测试出来只有两个员工按正常1000元加上去了。但是另外一个却加了2000元,是代码哪里出问题了吗?求指点/