当前位置: 代码迷 >> Oracle管理 >> update select 批量更新解决方案
  详细解决方案

update select 批量更新解决方案

热度:24   发布时间:2016-04-24 04:54:47.0
update select 批量更新
有近2万的数据需要更新。我用了update select ,结果花了差不多10分钟,有没办法改进优化?请指教。语句例子如下。
    update tb1 set a1=(select a1 from tb2),a2=(select a2 from tb2),a3=(select a3 from tb2)
------最佳解决方案--------------------
update tbl set (a1,a2,a3) = (select a1,a2,a3 from tb2)
然后用rownum分批commit
------其他解决方案--------------------
问题的意义是是?
先看是查询慢还是插入慢,根据情况进行处理,
------其他解决方案--------------------
引用:
update tbl set (a1,a2,a3) = (select a1,a2,a3 from tb2)
然后用rownum分批commit
这个是在数据库中写脚本处理吗?我现在在一个应用程序上处理有没好的办法
------其他解决方案--------------------
引用:
update tbl set (a1,a2,a3) = (select a1,a2,a3 from tb2)
然后用rownum分批commit
照着你的sql语句。我速度快多了了,1分多钟搞定。谢谢
  相关解决方案