Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Best way to compare records ?

Re: Best way to compare records ?

From: Happy <nothanks_at_hamster.com>
Date: Sat, 27 Oct 2001 10:49:05 +0100
Message-ID: <9rdv3b$a6h$1@plutonium.btinternet.com>


We had to do much the same thing, we needed a tool that found the differences only from two identical tables.

I don't know if this helps, but for us it worked and was pretty quick.

create table Sames as
Select (column list)
from table_1
union
select (column_list)
from table_2;

then
select 'OLD' , *
from table_1
where not exists ( select 1

                           from sames
                          where sames.key = table_1.key )
union
select 'NEW' , *
from table_2
where not exists ( select 1
                           from sames
                          where sames.key = table_2.key )

We actually used materialized views and refreshed the view everytime we need to do a check,

Happy

"CrazyIvan" <wilfried.vanbaelen_at_pandora.be> wrote in message news:a6vA7.12290$ic.762_at_afrodite.telenet-ops.be...
> What would be the best way to compare records field by field in PL/SQL?
> I have to update a table with several thousand records, some new, some the
> same, but some altered.
> Every record has to be compared field by field (not all fields, but most
of
> them) to detect changes.
>
> Thanx ia.
>
>
>
Received on Sat Oct 27 2001 - 04:49:05 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US