title: Oracle commits in for loop
body: <p>I have procedure using for-loop for inserting rows from external table to a normal one. The table have about 6-7 columns. Right now I have commit on every insert, which takes about 20 minutes to insert 4mill records. Is it possible to optimize that using commit on every 1k rows or 5k using </p>
  
  <pre><code>if mod(i,5000)=0 then
  commit;
  </code></pre>
  
  <p>and here is how the loop looks like now:</p>
  
  <pre><code>FOR i IN 1..arr.COUNT
                      LOOP
                        begin
                                INSERT  INTO A(...)
                                values( ...);
  
                                commit;
                          end;
                     END LOOP;
  </code></pre>