compare two tables and update differences
770714May 3 2010 — edited May 3 2010Hi 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