Comparing two records
Date: 25 Aug 2001 02:14:25 -0700
Message-ID: <c8cdde9.0108250114.3e83ae88_at_posting.google.com>
Hi,
I wish to compare two records in a table and identify the fields which
are different. The table will have 30-40 fields. It is always 2 rows
which i wish to compare.
For eg.
table company_detail
This is the process i have in mind:
step1 :
step2:
step3 :
if (rec1.field2 <> rec2.field2)
fields : field1 , field2 , field3 .... field 30
pick record1 : select * from company_detail where co_name='ABC' and
date_of_entry='01-jan-2001';
pick record2: select * from company_detail where co_name='ABC' and
date_of_entry='01-feb-2001';
identify / compare each field in rec1 and rec2
add to array if different
return array of field_names which are diff.
{
array[i]=rec1.field1
i=i+1;
}
{
array[i]=rec1.field2
i=i+1;
}
.....
return addtoarray;
- snippet ends --
however, i think this is a very long process and am looking for something more efficient.
Thanks in advance,
Vini Received on Sat Aug 25 2001 - 11:14:25 CEST