Learn the cause and how to unravel the ORA-02290 error message in Oracle.
Description
When you encounter an ORA-02290 error, the following error message will appear:
ORA-02290: check constraint violated
Cause
You tried to execute a SQL declaration that violated a check constraint.
Resolution
The option(s) to resolve this Oracle error are:
Option #1
Rewrite the SQL declaration so that the test constraint is not violated.
For example, if you created the following table:
CREATE TABLE suppliers
( supplier_id numeric(4),
supplier_name varchar2(50),
CONSTRAINT check_supplier_id
CHECK (supplier_id BETWEEN 100 and 9999)
);
And then tried to execute the following INSERT statement:
INSERT INTO suppliers
( supplier_id, supplier_name )
VALUES
( 1, 'IBM' );
You would receive the following error message:
You may want to correct this error by means of both enhancing the check constraint to allow the supplier_id column to contain a fee under 50 or you should try losing the check constraint.
Leave a Review