Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

compare two tables and update differences

770714May 3 2010 — edited May 3 2010
Hi All
Sorry for the newbie question, but I am a beginner in this.

I have two tables, both have an identical structure -

CODE - NUMBER(6,0) Store code, this is the primary key and does not change, and is unique
ADDRESS1
ADDRESS2
ADDRESS3 - all VARCHAR2(100)

One of the tables is named MASTER, the other is UPDATES. MASTER contains several hundred lines, whereas the UPDATES table may have anywhere from none to 10 or more.
I want to compare the UPDATES table against the MASTER table, and where there is a difference, apply the differences in the UPDATES table to the MASTER table - so if the address of a store changes, then the change is reflected in the MASTER table by being overwritten with the data contained in the UPDATES table.

I thought perhaps using cursors and comparing each field but there must be a more efficient way.

I hope I have explained it clearly enough..any help would be greatly appreciated.

Thanks
Bill
This post has been answered by Solomon Yakobson on May 3 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 31 2010
Added on May 3 2010
3 comments
929 views