Integrity constraints

2023-10-27 09:57:43  Updated

Integrity constraints ensure that data complies with business rules and prevent invalid data from being inserted into database tables. This topic describes how to use integrity constraints to prevent invalid data from being inserted into database tables.

In OceanBase Database in Oracle mode, a tenant can use integrity constraints to prevent invalid data from being inserted into database tables. Integrity constraints ensure that data stored in databases complies with specific business rules. If a DML statement is executed but violates an integrity constraint, the statement is rolled back, and an error message is returned. Operations on synonyms of views and tables must comply with the integrity constraints on the base tables.

In OceanBase Database in Oracle mode, you can modify the ENABLE and DISABLE fields of a constraint to specify whether the constraint takes effect.

For example, assume that you have defined an integrity constraint on the salary column of the employees table. This integrity constraint disallows the insertion of a row where the value in the salary column is greater than 10000 into the employees table. If an INSERT or UPDATE statement violates this integrity constraint, the statement is rolled back, and an error message is returned.

For more information about integrity constraints, see Data integrity.

Contact Us