Skip to content
Advertisement

ORA-02290: check constraint violated

I keep getting the message “ORA-02290: check constraint violated” whenever I try to insert values into my table.

Here’s the code for the table STORE:

And here’s the INSERT statements I am trying to accomplish:

It has created the 4th, 6th, and 7th values, but not the rest. What is going wrong?

Advertisement

Answer

You are violating the CHECK constraint as the values allowed doesn’t match with the value you are trying to insert:

CHECK (Country IN(‘Singapore’,’India’,’United States’,’Peru’,’Phillippines’,’People”s Republic of China’,’Canada’))

VALUES (2, ‘Eastern Treasures’, ‘Manila’, ‘Philippines’, ’63-2-654-2344′, ’63-2-654-2349′, ‘Sales@EasternTreasures.com.ph’, ‘Gracielle’)

'Phillippines' in the constraint doesn’t match with 'Philippines' in the insert statement.

Correct the country name in the CHECK constraint to 'Philippines' and it will work fine:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement