Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unique Constraint Violated in SQL

I'm trying to add data into my SQL Database, and when I enter the following code:

INSERT INTO EMPLOYEES 
VALUES('100','STEVEN','King','[email protected]','PSEUDO',
to_date('17-JAN-87','dd-mm-yy'),'AD_VP',24000,0.45,90);

I get the following error:

ERROR at line 1:
ORA-00001: unique constraint (ODEHat01.SYS_C00292486) Violated

I am not sure what I am doing wrong, because when I describe my table(desc employees;), it shows that I have 10 fields, and I am trying to enter data into ten fields. Any help would be very much appreciated so I can enter the data into my employees table. Thank you.

like image 269
atodeh Avatar asked Dec 26 '22 19:12

atodeh


1 Answers

That means that the table has a unique index on one of its fields, and that you are trying to insert a value that already exists.

Very likely, the index is on the first column in the table, and there is already a row with a value of "100".

like image 121
Joe Avatar answered Dec 28 '22 09:12

Joe