title: Comparing two tables to see for any change in column in PL/SQL
body: <p>There is table with values of employee and their middle name </p>
  
  <pre><code>ID FIRST NAME    MIDDLE NAMES
  
  1  'ABC'          
  2  'Jck'           w
  3   'Zoya'         A
  </code></pre>
  
  <p>Now there is another table B with some values </p>
  
  <pre><code>ID FIRST NAME    MIDDLE NAMES   Flag
  
      4  'XYZ'          
      2  'Jck'           
      1   'ABC'         A
  </code></pre>
  
  <p>Now  i want to check in table B that if the middle names in B is same as that of table A. that is middle name exists in table A and not B against the same employee number or vice versa then THE Flag should be returned as 'N'</p>
  
  <p>I am using the query :</p>
  
  <pre><code>update table b
  set flag='N'
  WHERE NOT EXISTS ( SELECT 1 FROM TABLE B
  WHERE B.MIDDLE_NAMES=A.MIDDLE_NAME
  AND ID=A.ID)
  </code></pre>