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

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;

你可能感兴趣的:(数据库,oracle)