title: I want to update records of 2 tables in Database based on matching Key
body: <p>I have 2 tables, Source and Target as below,</p>
  <h2>Source</h2>
  <pre><code>Key | Source_ID | Target_ID | Source_Data
  -----------------------------------------
  1     s1          null        some_source_data
  2     s2          null        some_source_data
  </code></pre>
  <h2>Target</h2>
  <pre><code>Key | Source_ID | Target_ID | Target_Data
  -------------------------------------------
  1     null        t1          some_target_data
  2     null        t2          some_target_data
  </code></pre>
  <p>Initially Source Table has existing records, and inserting records to Target table freshly
  Now my requirement is to update the records of Target_ID from Target Table and Source_ID from Source Table based on Key matching, As of now I am doing it on java, by joining these two tables using Key Column and hold the result in Result Set and execute update query for both the table one by one, its working quite well in case of less number of data, but in case of large amount of data Java execution is taking a huge time for 200000 records on each table took 2 hours to complete the operation, now I want it to move out of java and do it in SQL only like a trigger or PL/SQL, on inserting the records in Target Table these Trigger or Script should run automatically and do the Job what am doing java, need your help/suggestion on how to implement this, Am using DB2 Database</p>