title: Run Oracle update statements in a batch mode
body: <p>I need to run a couple of relatively simple SQL update statements to update a single column in an Oracle table with 14.4 million rows. One statement runs a function written in Java and the JVM runs out of memory as I’m doing the update on all 14.4 million rows.</p>
  
  <p>Have you written a kind of batch PL/SQL routine that can break this simple update into sets of, say, 10K records per batch? I know that if I can commit my updates after a bunch of records, it’ll go a lot faster and I won’t run out of memory. I’m sure there’s a simple way to do this using a <code>FOR loop</code> and <code>row_num</code> but I'm not making much progress.</p>
  
  <p>Here are the two statements I need to run for each batch of <em>n</em> records:</p>
  
  <p>first one:</p>
  
  <pre><code> update vr_location l set l.usps_address=(
     select mylib.string_utils.remove_duplicate_whitespace(
     house_number || ' ' || pre_street_direction || ' ' || street_name || ' ' || 
     street_description || ' ' || post_street_direction)
   from vr_address a where a.address_pk=l.address_pk);
  </code></pre>
  
  <p>second:</p>
  
  <pre><code>update vr_location set usps_address = mylib.usaddress_utils.parse_address(usps_address);
  </code></pre>