Oninit Logo
The Down System Specialists
+1-913-674-0360
+44-2081-337529
Partnerships Contact
Finderr

-677 Check constraint cannot contain subqueries or procedures.

A check constraint cannot contain a subquery or a procedure. Subqueries are disallowed in check constraints because they depend on the state of the database. For data integrity, the evaluation of a check constraint must not vary or depend on the state of the database.

Example of error:

CREATE TABLE new_stock ( stock_num SERIAL PRIMARY KEY, unit_price MONEY CHECK (unit_price >= (SELECT unit_price FROM stock WHERE manu_code = 'HRO')), manu_code CHAR(3));

Verify that your statement does not have a subquery or procedure in a check constraint.