oracle游标批量处理数据
declare
cursor cur_emp is
select * from emp;
type type_cur_emp_list is table of cur_emp%rowtype;
v_emp_rows type_cur_emp_list;
begin
open cur_emp;
loop
exit when cur_emp%notfound;
fetch cur_emp bulk collect
into v_emp_rows limit 5;
for i in 1 .. v_emp_rows.count loop
dbms_output.put_line(v_emp_rows(i).ename);
if v_emp_rows(i).ename='SCOTT' then
update emp g set g.comm = 100.00 where g.empno = v_emp_rows(i).empno;
commit;
end if;
end loop;
end loop;
close cur_emp;
end;
/
浙公网安备 33010602011771号