Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.