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 the column values between two tables

SureshKumar.GJul 20 2018 — edited Jul 20 2018

Hi,

I just want to compare the column values  of two tables and update if find any difference.

Please share the logic / approach how I shall achieve this comparison and update.

Example: EMP and EMPBKP are the tables with same structure.

I compare the two tables using the unique number column EMPNO which will reside in both the tables.

If any column vlaues are different for the EMPNO in EMP table, then I need to update that column in EMPBKP table for the same EMPNO.

EMP

====

EMPNO  ENAME  JOB  MGR  SAL

===========================

1000     PETER    TL                100000

EMPBKP

========

EMPNO  ENAME  JOB  MGR  SAL

===========================

1000     PETER     TL                100000

Later if EMP table SAL is updated as 200000 for the EMPNO.

Then EMPBKP should be compared and based on the differences that particular column has to be updated.

Note: This is one example, update can happen on any such column.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 17 2018
Added on Jul 20 2018
4 comments
226 views