Re: Comparing two records

From: C. R. Soza <crsoza_at_hotmail.com>
Date: 29 Aug 2001 07:50:43 -0700
Message-ID: <c18ea449.0108290650.51d7cc6d_at_posting.google.com>


"Engima_Cyanide" <dovestarr_at_erols.com> wrote in message news:<9mgqth$5vu$1_at_bob.news.rcn.net>...
> Use TOAD. It is faster and built in. Why recreate the wheel?
>
> Chris
>
>
> "M. Moiz" <moiznet2002_at_yahoo.com> wrote in message
> news:53b2483d.0108280027.136b7617_at_posting.google.com...
> > Hi!...Vini
> >
> > Try creating a view for the two records and then compare the fields
> > but before hand place a Bitmap index on the tables...
> >
> > Hope this resolves the problem.
> >
> > Moiz.
> >
> >
> >
> > vini_sethi_at_hotmail.com (Vini Sethi) wrote in message
 news:<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
> > > fields : field1 , field2 , field3 .... field 30
> > >
> > > This is the process i have in mind:
> > >
> > > step1 :
> > > pick record1 : select * from company_detail where co_name='ABC' and
> > > date_of_entry='01-jan-2001';
> > >
> > > step2:
> > > pick record2: select * from company_detail where co_name='ABC' and
> > > date_of_entry='01-feb-2001';
> > >
> > > step3 :
> > > identify / compare each field in rec1 and rec2
> > > add to array if different
> > > return array of field_names which are diff.
> > >
> > > --- pseudo code snippet --
> > > i=0;
> > > if (rec1.field1 <> rec2.field1)
> > > {
> > > array[i]=rec1.field1
> > > i=i+1;
> > > }
> > >
> > > if (rec1.field2 <> rec2.field2)
> > > {
> > > 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

The two records are always going to be different because date_of_entry is different (unless you chose to ignore this field). The best way to compare this is by doing a select .... minus select ..... in one statement. Received on Wed Aug 29 2001 - 16:50:43 CEST

Original text of this message