Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL: how to let it continue when unique constraint violated
In order to ignore the duplicate key value error and continue, you need
the dup_value_in_index as a local exception:
declare cursor c1 is select myvalue from mytable;
begin
for l1 in c1 loop
begin
insert into mynewtable values (l1.myvalue);
exception
when dup_value_in_index then
null; end;
end loop;
end;