场景:要批量修改某张表某个字段的数据,大概1万多吧,一执行更新就卡死,找到这种办法耗时比较短:
BEGIN
FOR cur IN (
--此处写要更新数据的范围
select t.*, t.rowid from mstdata.md_product_structure_ext t
inner join mstdata.md_product_structure tm on t.md_product_structure_ext_id = tm.product_structure_ext_id
where tm.version = 1034 and tm.hierarchy_level = 3
) loop
--更新内容
update mstdata.md_product_structure_ext t set t.vehicle_mold = 'SUV,MPV' where t.md_product_structure_ext_id = cur.md_product_structure_ext_id;--
END loop;
END;
游标法,真香!