ORA-00001: unique constraint violated, using SEQUENCE.NEXTVAL

Six Stars

ORA-00001: unique constraint violated, using SEQUENCE.NEXTVAL

Hello,
I am trying to update my date table. I have an integer ID generated from an Oracle SEQUENCE (SEQ.NEXTVAL) which is defined as the primary key of my table DATE.

To make my update, I use the ID_DATE (which is the date in the format dd / MM / YY) from DATE_TMP, which is the primary key of DATE_TMP.

 

But when i'm trying to update DATE with DATE_TMP, I have this unique constraint error violated.

 

There's 13000 records in DATE_TMP, then I add 2 records manually, but they're not inserted in DATE.

I do not understand why I can not insert new values into my table.

What is my clumsiness?

 

Should I create a primary key on these 2 columns (ID and ID_DATE) ?

 

Thanks


Accepted Solutions
Six Stars

Re: ORA-00001: unique constraint violated, using SEQUENCE.NEXTVAL

Ok it's my fault, cleaning everything and starting from 0 it works well.

I think I dropped my sequence and recreated without emptying my table, so maybe he was trying to insert my new lines with ID starting from 1.


All Replies
Eleven Stars

Re: ORA-00001: unique constraint violated, using SEQUENCE.NEXTVAL

can you give us the creation script of your tables with constraints key and triggers ?

Francois Denis

Tag as "solved" for others! Kudos to thanks!

Sixteen Stars

Re: ORA-00001: unique constraint violated, using SEQUENCE.NEXTVAL

This is really difficult to understand, you may need to show your table structures with some data to make it easier. However the error is a standard SQL error. You are essentially trying to duplicate a primary key. You mention "update" several times. Do you mean "update" or do you mean "insert"? If you are updating, you probably shouldn't be updating your primary key as well. I suspect that you two tables are not aligned and you are updating keys which get them out of alignment with your sequence. 

Six Stars

Re: ORA-00001: unique constraint violated, using SEQUENCE.NEXTVAL

Ok it's my fault, cleaning everything and starting from 0 it works well.

I think I dropped my sequence and recreated without emptying my table, so maybe he was trying to insert my new lines with ID starting from 1.