場景:要批量修改某張表某個字段的數據,大概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;
游標法,真香!