ORA-00001 Error Message
Learn the cause and how to resolve the ORA-00001 error message in Oracle.
Description
When you encounter an ORA-00001 error, the following error message will appear:
- 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.
Resolution
The option(s) to resolve this Oracle error are:
Option #1
Drop the unique constraint.
Option #2
Change the constraint to allow duplicate values.
Option #3
Modify your SQL so that a duplicate value is not created.
Note
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.
No comments:
Post a Comment