Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Mayot
Contributor III

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

Labels (2)
1 Solution

Accepted Solutions
Mayot
Contributor III
Author

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.

View solution in original post

3 Replies
fdenis
Master

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

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. 

Mayot
Contributor III
Author

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.