Re: How to avoid appending matching records ?

From: Larry Cipriani <lvc_at_cbnews.cb.att.com>
Date: Wed, 22 Apr 1992 16:55:22 GMT
Message-ID: <1992Apr22.165522.28187_at_cbnews.cb.att.com>


In article <1992Apr20.122055.22413_at_bronze.ucs.indiana.edu> poorting_at_silver.ucs.indiana.edu (Robert Poortinga) writes:
>In article <1992Apr16.011759.6548_at_cbnews.cb.att.com> lvc_at_cbnews.cb.att.com (Larry Cipriani) writes:
>>I have two tables A and B which share a common schema.
>>In that schema I have 60 fields, f1, f2, ... f60.
>>
>>Basically, I want to append B - A to A, but I want the
>>difference to operate only on two fields f1, and f2. From
>>what I can tell, 'MINUS' operates on entire records.
>
>How about:
>
> insert into A
> select * from B
> where (B.f1, B.f2)
> not in (select A2.f1, A2.f2 from A A2)
> ;

I ended up doing something very similar to this.

>Try writing a PL/SQL procedure if you want. It may be faster than the
>above example.

We don't have PL/SQL. The efficiency from the above is good enough even with a 72,000 record table [max for this app], and this stuff is run automagically at 4 am when the system is almost 100% idle so it's not a concern at this point.

-- 
Larry Cipriani, att!cbvox1!lvc or lvc_at_cbvox1.att.com
"Be wary of strong drink.  It can make you shoot
at tax collectors - and miss." -- Lazarus Long
Received on Wed Apr 22 1992 - 18:55:22 CEST

Original text of this message