title: Oracle Pl/SQL procedure to update values of one table to another
body: <p>My requirment here is i have two tables with two attributes.I have written a procedure which should take values(sor_ID) from table1 and update it in Table 2 based on primary key.</p>
  
  <pre><code>Table 1 
  -------
  Primary Key | Sor_ID
  
  AAA         | 100
  
  BBB         | 200
  
  Table 2
  -----
  Foreign Key | Sor_ID
  
  AAA         | NULL
  
  BBB         | NULL
  </code></pre>
  
  <hr>
  
  <pre><code>create or replace
      Procedure UPDDATE_SORID_2 
  IS
      s_id VARCHAR2(256 byte);
  
      CURSOR C1 IS
      SELECT A.SOR_INSTRMNT_ID
      FROM TEST_TABLE B,TEMP_SOR_ID A
      where A.INSTRMNT_KEY=B.INSTRMNT_KEY;
  BEGIN
  
      open c1;
      loop
      fetch c1 into s_id;
  
      update TEST_TABLE set SOR_INSTRMNT_ID=S_ID; 
  
      commit;
      end LOOP;
      close c1;
  
  EXCEPTION
      WHEN OTHERS THEN
      RAISE_APPLICATION_ERROR(-20001,'An error was encountered - '
                                      ||SQLCODE||' -ERROR'||SQLERRM);
  end;
  </code></pre>
  
  <p>This procedure returns nothing updated even after hours of running it. Kindly suggest</p>