title: Update million rows using rowids from one table to another Oracle
body: <p>Hi I have two table with million rows in each.I have oracle 11 g R1
  I am sure many of us must have gone through this situation.</p>
  
  <p>What is the most efficient and fast way to update from one table to another where the values are DIFFERENT.</p>
  
  <p>Eg: Table  1  has 4 NUMBER columns with a high precision eg : 0.2212454215454212</p>
  
  <p>Table 2 has 6 columns.
  update table 2's  four columns based on common column on both the tables, only the different ones.</p>
  
  <p>I have something like this</p>
  
  <pre><code>DECLARE
  TYPE test1_t IS TABLE OF test.score%TYPE INDEX BY PLS_..;
  TYPE test2_t IS TABLE OF test.id%TYPE INDEX BY PLS..; 
  TYPE test3_t IS TABLE OF test.Crank%TYPE INDEX BY PLS..;
  
  vscore test1_t;
  vid test2_t;
  vurank test4_t;
  
  BEGIN
    SELECT id,score,urank
      BULK COLLECT INTO vid,vscore,vurank
      FROM test;
  
    FORALL i IN 1 .. vid.COUNT
      MERGE INTO final T
        USING (SELECT vid (i) AS o_id,
                      vurank (i) AS o_urank,
                      vscore (i) AS o_score FROM DUAL) S
        ON (S.o_id = T.id)
      WHEN MATCHED THEN
        UPDATE SET T.crank = S.o_crank
        WHERE T.crank &lt;&gt; S.o_crank;
  </code></pre>
  
  <p>Since the numbers are with high precision is it slowing down?</p>
  
  <p>I tried Bulk Collect and Merge combination still its taking time ~ 30 mins for worst case scenario if I have to update 1 million rows.</p>
  
  <p>Is there something with rowid?
  Help will be appreciated.</p>