–数据量如果超过30万要采用分段提交的方式。若表数据量达到千万级,可10w一批提交。
declare
cursor mycursor is
select rowid row_id, --获取rowid
sidec,
id --PK字段
from SIDE_T t
where t.SIDEA = 100;
type t_data is table of mycursor%rowtype;
v_data t_data;
begin
open mycursor;
loop
fetch mycursor bulk collect
into v_data limit 10000; --10000行提交一次
exit when v_data.count = 0;
forall i in v_data.first … v_data.last
update SIDE_T
set SIDEC = ‘更新’
where rowid = v_data(i).row_id; --通过rowid更新记录方式
–where id = v_data.id; --通过PK更新记录方式
commit;
end loop;
close mycursor;
end;