ORA-00001 Unique constraint violated
January 30th, 2009 Posted in Oracle Tip
I am going to start posting information on common Oracle errors. These are error I see all the time in my daily work or errors I see from other’s working on my databases.
Th first error I see a lot is “ORA-00001 Unique constraint violated”. This error means that an attempt has been made to insert a record with a duplicate (unique) key. This error will also be generated if an existing record is updated to generate a duplicate (unique) key. Typically this is a duplicate primary key, but it need not be the primary key. On our data warehouse I see this error several times a day. Primary keys and unique constraints help keep the data clean.
You really only have a few option when dealing with this error:
- Remove the unique restriction.
- Change the restriction to allow duplicate keys. An index could be changed to be a non-unique index, but remember that the primary key must always be unique
- Do not insert the duplicate key