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!

column comparison

user9229402Dec 30 2016 — edited Dec 30 2016

Hi,

I need to compare two tables row by row and produce mismatches by column names. i dont want to use dbms comparison utilities. Is there anyway to do in ananmous block? im thinking of two cursors for two tables and compare column by column. In below pseudo code, im using uncl arrays, comma to table utilities in oder to get dynamic column list. but i getting value mismatch error in cursor. another issue im facing is to get column name dynamically. Give me some suggestions to resolve these erros.

declare

variables

cursor c1

  select ..dynamic column list..

  from tableA;

begin

comma to table( ..dynamic column list..);

for r in (select ..dynamic column list..

  from tableB)

 

  -- get one column per row and compare

  if c1.column = r.column then

  column match

  else

  column mismatch

  -- store and display the mismatched columns

end loop

end

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 27 2017
Added on Dec 30 2016
14 comments
2,692 views