Oracle插入数据每5000条提交一次

declare
  i_count int;
  i_large int;
begin
  i_count := 1;
  select ceil(count(1) / 5000)
    into i_large
    from tablename ch;
  while i_count <= i_large loop 
   
    update tablename a
       set a.aa   = i_count
       where a.aa is  null
       and rownum <= 5000;
      
    commit;
    i_count := i_count + 1;
  end loop;
end;
Logo

华为云1024程序员节送福利,参与活动赢单人4000元礼包,更有热门技术干货免费学习

更多推荐