plsql - PL/SQL: procedure to process a comparison between two tables -


this example need :

table 1 :

id  champ1 champ2 champ3    1           s      q    2      d      k         3      d           s 

table 2:

id  champ1 champ2 champ3    1           s      q    2      q              3                k   

a procedure feeds table3 result of comparison between table 1 , table 2

table 3:

id_exc name_champ noted_val except_val    2    champ1       d         q    3    champ1       d            2    champ2       k            3    champ3       s         k 

please, need if had same challenge :)

thanks in advanced

data setup:

create table table1     (id int, champ1 varchar2(1), champ2 varchar2(1), champ3 varchar2(1)) ;  insert      table1 (id, champ1, champ2, champ3)          values (1, 'a', 's', 'q')     table1 (id, champ1, champ2, champ3)          values (2, 'd', 'k', 'a')     table1 (id, champ1, champ2, champ3)          values (3, 'd', 'a', 's') select * dual ;  create table table2     (id int, champ1 varchar2(1), champ2 varchar2(1), champ3 varchar2(1)) ;  insert      table2 (id, champ1, champ2, champ3)          values (1, 'a', 's', 'q')     table2 (id, champ1, champ2, champ3)          values (2, 'q', 'a', 'a')     table2 (id, champ1, champ2, champ3)          values (3, 'a', 'a', 'k') select * dual ; 

the below query give differences

select *    ((select *             table1           minus           select *             table2)          union          (select *             table2           minus           select *             table1));   id  champ1  champ2  champ3 2   d   k   2   q     3       k 3   d     s 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -