Oracle 大批量更新數據方法(游標)


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

游標法,真香!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM