Adsense Ad

Thursday, 18 May 2017

Oracle: ORA-02290 Error Message

ORA-02290 Error Message

Learn the cause and how to resolve 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 <constraint_name> violated

Cause

You tried to execute a SQL statement that violated a check constraint.

Resolution

The option(s) to resolve this Oracle error are:

Option #1

Rewrite the SQL statement so that the check 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:
Oracle PLSQL
You could correct this error by either modifying the check constraint to allow the supplier_id column to contain a value below 50 or you could try dropping the check constraint.

No comments: