patternMinor
ORA-00001 - But no name
Viewed 0 times
00001butoraname
Problem
We have a huge table with nested tables and such. We are using Bulk Collect & FORALL to insert.
When loading data, I am getting this error:
ORA-00001: unique constraint (.) violated
There is no constraint name......so, how can I find out 1) What or where is causing the error, and, 2) Which record it is?
I know you can keep exceptions with FORALL, but we are doing this in lots of 500, so it is hard to find out the actual record, and what constraint / nested table it is, etc.
I'm looking for any help anyone can give.
Many thanks!
When loading data, I am getting this error:
ORA-00001: unique constraint (.) violated
There is no constraint name......so, how can I find out 1) What or where is causing the error, and, 2) Which record it is?
I know you can keep exceptions with FORALL, but we are doing this in lots of 500, so it is hard to find out the actual record, and what constraint / nested table it is, etc.
I'm looking for any help anyone can give.
Many thanks!
Solution
A possible bug for not displaying the constraint name with bulk DML and
Bug 7210333 : CONSTRAINT NAME IN SQLERRM IS NOT OUTPUT WHEN SAVE EXCEPTIONS IS USED
To catch the records causing the error, you could use DML error logging as well:
Insert data:
Actual data:
Rows violating the constraint with row data and constraint name:
SAVE EXCEPTIONS clause:Bug 7210333 : CONSTRAINT NAME IN SQLERRM IS NOT OUTPUT WHEN SAVE EXCEPTIONS IS USED
To catch the records causing the error, you could use DML error logging as well:
create table t1(c1 number unique);
begin
dbms_errlog.create_error_log('T1', 'T1_ERRORS');
end;
/Insert data:
declare
type t_varray is varray(4) of number;
l_varray t_varray := t_varray(1, 2, 2, 3);
begin
forall i in 1..l_varray.count
insert into t1 values (l_varray(i))
log errors into t1_errors
reject limit unlimited;
end;
/Actual data:
select * from t1;
C1
----------
1
2
3Rows violating the constraint with row data and constraint name:
select * from t1_errors;
ORA_ERR_NUMBER$ ORA_ERR_MESG$ ORA_ERR_ROWID$ ORA_ERR_OPTYP$ ORA_ERR_TAG$ C1
--------------- ------------------------------------------------------------ -------------------- -------------------- -------------------- ----------
1 ORA-00001: unique constraint (BP.SYS_C0013693) violated I 2Code Snippets
create table t1(c1 number unique);
begin
dbms_errlog.create_error_log('T1', 'T1_ERRORS');
end;
/declare
type t_varray is varray(4) of number;
l_varray t_varray := t_varray(1, 2, 2, 3);
begin
forall i in 1..l_varray.count
insert into t1 values (l_varray(i))
log errors into t1_errors
reject limit unlimited;
end;
/select * from t1;
C1
----------
1
2
3select * from t1_errors;
ORA_ERR_NUMBER$ ORA_ERR_MESG$ ORA_ERR_ROWID$ ORA_ERR_OPTYP$ ORA_ERR_TAG$ C1
--------------- ------------------------------------------------------------ -------------------- -------------------- -------------------- ----------
1 ORA-00001: unique constraint (BP.SYS_C0013693) violated I 2Context
StackExchange Database Administrators Q#172544, answer score: 3
Revisions (0)
No revisions yet.