title: Update query taking time to execute
body: <p>I have a table xx_wr which has a column action_code which i want to 
  update according to the action_code column of PER_ASG.</p>
  
  <p>This PER_ASG has columns effective_start_date and effective_end_date .
  Only the max effective_start_date from this table that is the latest record should be picked to update the xx_wr.</p>
  
  <pre><code>PER_ASG 
  
  EFFECTIVE_START_DATE EFFECTIVE_END_DATE ACTION_CODE PERSON_ID
  01-JAN-2016          31-DEC-4712         HR          10
  02-FEB-2015          31-DEC-2015         TERM        10
  </code></pre>
  
  <p>So from this table, the latest row from 01-JAN-2016 should be picked and Action_code HR should update the action_code in WR.</p>
  
  <p>I Have written the below query for this. But it is taking 3 hrs to update 10k rows. Is there any way I can modify my query to improve the performance ?</p>
  
  <pre><code> update XX_WR wr
              set wr.action_code = 
              (
              select pam.action_code
              from PER_ASG pam
              where 1=1
              and pam.person_id=wr.person_id
              and pam.effective_start_date = (select max(ppm.effective_start_date) from PER_ASG ppm 
              where 1=1 
              and ppm.person_id = pam.person_id
              )) 
              where 1=1;
  </code></pre>