我觉得current of的最大好处就是,当要写巨多where条件才能唯一确定一条记录时比较清晰。
比如:where deptno=20 and sal<20000 and status = 'Sales_Manager' ...等等一串东西时。
比如:where deptno=20 and sal<20000 and status = 'Sales_Manager' ...等等一串东西时。
declare
cursor c_emp_sal is
select * from emp_bak where ename = 'ALLEN' for update of sal;
begin
for emp in c_emp_sal loop
update emp_bak set sal = sal + 10000 where current of c_emp_sal;
end loop;
end;