I am catching errors from a bulk insert operation like this:
begin
--bulk insert
forall i in v_data.first .. v_data.last save exceptions
insert into my_filter_table values v_data (i);
commit;
exception
-- catch and print the saved-up DML errors.
when X_DML_ERRORS then
declare
v_iteration number;
begin
dbms_output.put_line('');
dbms_output.put_line('DML Errors:');
for i in 1 .. SQL%BULK_EXCEPTIONS.count loop
v_iteration := SQL%BULK_EXCEPTIONS(i).error_index;
dbms_output.put_line('Iteration: '||v_iteration||' Message: '||
SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
end loop;
end;
end;
The output looks something like this:
Iteration: 3 Message: ORA-01400: cannot insert NULL into () Iteration: 4 Message: ORA-02290: check constraint (.) violated Iteration: 8 Message: ORA-00001: unique constraint (.) violated
The fact that I'm getting errors does not bother me, as I am testing error-handling code. The problem is that the Oracle error message is not displaying the the constraint names, i.e. it displays check constraint (.) violated
but that doesn't tell me WHICH check constraint I violated.
Does anyone know what's up with this?
(Oracle version 10.2)