Hi,
l would like to know if there is any way to continue insert into select after duplicate key error. meaning: I would like to disregard the exception and to continue to insert the next record.
I'm familiar with ignore_row_on_dupkey_index but as far as I know, hints are should not be used in Production environment.
Few things:
1. The query inserts millions of records into an empty table.
2. I would prefer a good solution with a small effect on the performance.
Thanks,
Alex
An example of code that uses ignore_row_on_dupkey_index:
CREATE TABLE customers
( customer_id number(10) NOT NULL,
customer_name varchar2(50) NOT NULL,
city varchar2(50),
CONSTRAINT customers_pk PRIMARY KEY (customer_id)
);
CREATE TABLE customers_2
( customer_id number(10) NOT NULL,
customer_name varchar2(50) NOT NULL,
city varchar2(50)
);
insert into customers_2 values(1,'A','TLV');
insert into customers_2 values(2,'B','TLV');
insert into customers_2 values(2,'C','TLV');
insert into customers_2 values(3,'C','TLV');
SELECT * FROM Customers_2
insert /*+ ignore_row_on_dupkey_index(customers, customers_pk) */
into customers select * from Customers_2
select * from Customers;