Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 1 down vote accepted

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;
share|improve this answer
    
Thanks kubanczyk, it worked! – Mehdi Es-haghi Feb 11 '12 at 5:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .