码迷,mamicode.com
首页 > 数据库 > 详细

oracle更新大量数据太慢,可以通过游标实现的例子

时间:2016-06-05 17:07:12      阅读:308      评论:0      收藏:0      [点我收藏+]

标签:

declare cursor city_cur is
select t.new_customer_id,t.old_customer_id from
citsonline.crm_customer_tmp6 t
where t.new_customer_id!=t.old_customer_id
order by new_customer_id;
begin
for my_cur in city_cur loop

update platform.crm_service_customer_bak s
set s.customer_id=my_cur.new_customer_id
where s.customer_id=my_cur.old_customer_id;

/** 此处也可以单条/分批次提交,避免锁表情况 **/
if mod(city_cur%rowcount,1000)=0 then
dbms_output.put_line(‘----‘);
commit;
end if;
end loop;
commit;
end;

oracle更新大量数据太慢,可以通过游标实现的例子

标签:

原文地址:http://www.cnblogs.com/xiaohuihui123/p/5561047.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!