title: How to create mirror table in oracle by using triggers?
body: <p>I've created a trigger as follows:</p>
  
  <pre><code>create or replace trigger "PASSENGERS_BACKUP_T1"
  after
  insert or update or delete on "PASSENGERS"
  for each row
  begin
      if :NEW."P_ID" is  NOT null then 
          INSERT INTO PASSENGERS_BACKUP(
              PB_ID,
              PB_FIRST_NAME,
              PB_LAST_NAME,
              PB_STREET_ADDRESS1,
              PB_STREET_ADDRESS2,
              PB_CITY,
              PB_STATE,
              PB_POSTAL_CODE,
              PB_EMAIL,
              PB_PHONE_NUMBER1,
              PB_PHONE_NUMBER2,
              PB_URL,
              PB_CREDIT_LIMIT,
              PB_TAGS)
          VALUES (
              :new.P_ID,
              :new.P_FIRST_NAME,
              :new.P_LAST_NAME,
              :new.P_STREET_ADDRESS1,
              :new.P_STREET_ADDRESS2,
              :new.P_CITY,
              :new.P_STATE,
              :new.P_POSTAL_CODE,
              :new.P_EMAIL,
              :new.PHONE_NUMBER1,
              :new.PHONE_NUMBER1,
              :new.URL,
              :new.CREDIT_LIMIT,
              :new.TAGS);
      end if;
  end;
  </code></pre>
  
  <p>now, when I update​ an existing row in <code>"passengers"</code> table as per the above trigger another new row is getting added in <code>"passengers_backup"</code> table instead I would like to update the existing row whenever an update is done in <code>"passengers"</code> table rows. As, well If I delete a row in <code>"Passengers"</code> table, if that row exists in <code>'Passengers_backup'</code> table it should also get deleted. How can I acheive this? </p>
  
  <p>Thanks in advance.</p>