Updating a table in oracle using another table rows

1

I want to update each row of a oracle table based on another table's rows. To be more specific, There's a table called Contact with the following fields:

 code(PK), name, mobile, email

There's also another table called Contact_Updated with same fields. The question is how to update Contact records with their equivalent in Contact_Updated table?

any idea?

Mehdi Es-haghi

Posted 2012-02-09T12:32:55.640

Reputation: 13

Answers

1

Something along the lines of:

MERGE INTO Contact a
  USING Contact_Updated b
    ON (a.code = b.code)
  WHEN MATCHED THEN  /* no NOT MATCHED clause, so no inserts, update only */
    UPDATE SET a.name = b.name,  a.mobile=b.mobile,  a.email=b.email;

kubanczyk

Posted 2012-02-09T12:32:55.640

Reputation: 1 108