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!

query to compare source data and target data

ramya_162Jan 20 2017 — edited Jan 20 2017

Hi Experts,

I want to compare data in source and target tables.

I want to check column wise  total number of records and number of nulls in both source and target tables.

If counts are matching then it should display matching other wiase it should display not matching.

Source table

TABLE_S

SNUM SNAME   SLOC GRADE

100  RAJESH  HYD   A

200          BLR   A

300  KUMAR   VTZ   A

400  SIVA    VTZ   D

500  RUSTI   DLH   D

100  MEGHA   DLH

Target table

TABLE_T

SNUM SNAME   SLOC GRADE

100  RAJESH  HYD   A

200          BLR   A

300  KUMAR   VTZ   A

400  SIVA    VTZ   D

500  RUSTI        

100  MEGHA   DLH

I want to check column wise  total number of records and number of nulls in both source and target tables.

If counts are matching then it should display matching other wiase it should display not matching.

for

SNUM  it should display matching.

SNAME it should display matching.

SLOC  it should display not matching.Since in target table(TABLE_T) 1 null value for SLOC column where as in source table(TABLE_S) no nulls.

GRADE it should display not matching.Since in target table(TABLE_T) 2 nulls  for GRADE column where as in source table(TABLE_S) 1 null.

Please help me to write SQL query.

Thanks in advance.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 17 2017
Added on Jan 20 2017
2 comments
2,049 views