Home Privacy Policy Feedback Link to us Site Map

Oracle/PLSQL: ORA-00001 Error


Error:

ORA-00001: unique constraint (constraint_name) violated

Cause:

You tried to execute an INSERT or UPDATE statement that has created a duplicate value in a field restricted by a unique index.

Action:

The options to resolve this Oracle error are:
  1. Drop the unique constraint
  2. Change the constraint to allow duplicate values
  3. Modify your SQL so that a duplicate value is not created

If you are not sure which unique constraint was violated, you can run the following SQL:

select distinct table_name
from all_indexes
where index_name = 'CONSTRAINT_NAME';


In our example (see picture above), our constraint name would be SYS_C002459 and we would execute the following SQL:

select distinct table_name
from all_indexes
where index_name = 'SYS_C002459';

This would return the name of the table whose unique constraint we violated.