title: Merge statement help in oracle
body: <p>I am using merge for the 1 st time ... I went through existing questions but couldn't get proper help.</p>
  
  <p>Please help me with the below need,</p>
  
  <p>I have a table "table_a" with 3 columns A, B and C. C is a new column added combination of column A and B are unique, to be specific column B is a list of sub codes taken from table_b and configured against the entity in column A.</p>
  
  <p>I need to update column C with a hard coded value for the existing A and B combinations and if some subcode  missing from table_b in table_a I need to insert the rows for the same in table_a.</p>
  
  <p>eg. table_a                              </p>
  
  <pre><code>A    B   C                              
  =    =   =
  p    x
  p    y
  </code></pre>
  
  <p>table_b</p>
  
  <pre><code>M
  =
  x
  y
  z
  </code></pre>
  
  <p>After execution of query</p>
  
  <p>table_a</p>
  
  <pre><code>A    B   C                              
  =    =   =
  p    x   1   -- updated with column C
  p    y   1   -- updated with column C
  p    z   1   -- new row inserted for the row in table_b
  </code></pre>
  
  <p>Kindly let me know if anything is not clear.</p>