沉开

导航

 

场景:要批量修改某张表某个字段的数据,大概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;

游标法,真香!

posted on 2021-05-13 17:17  沉开  阅读(1876)  评论(0编辑  收藏  举报