title: Update Oracle table with values from another table
body: <p>I have two tables ORDERS and ORDER_TEMP and both are identical in structure. ORDER_ID is the primary key in both the tables.</p>
  
  <p>Now, I have to Update KEY_ID column in ORDER table from the value from ORDER_TEMP table.</p>
  
  <p>There are over million records in both the tables.</p>
  
  <pre><code>UPDATE ORDER  
  SET KEY_ID = ( SELECT KEY_ID FROM ORDER_TEMP WHERE  ORDER_TEMP.ORDER_ID = ORDER.ORDER_ID and ORDER_TEMP.PNP_GROUP=99) 
  </code></pre>
  
  <p>If i put a where clause in on the ORDER table and run it for one order it did work but when I did for the entire table it was running forever and it didn't work.</p>
  
  <p>Please help</p>