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

Home -> Community -> Usenet -> c.d.o.server -> SQL to insert only new records

SQL to insert only new records

From: John Stathakis <jlstath_at_mail.icon.co.za>
Date: 1997/05/05
Message-ID: <336DC9E2.6948@mail.icon.co.za>#1/1

Hello everyone,

Here is a SQL statement I wrote to insert records from one table into another. The catch is that it ignores records that are already there, so you never have a duplicate primary key failure.

Does this statement bypass the indexes, causing performance problems ?

INSERT INTO table2
SELECT a.field1, a.field2, a.field3 FROM table1 a, table2 b
WHERE

b.field1(+) = a.field1 AND
b.field2(+) = a.field2 AND
b.field1 is null AND
b.field2 is null;

Regards,
John Received on Mon May 05 1997 - 00:00:00 CDT

Original text of this message

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