In the Oracle mode of OceanBase Database, tenants can use integrity constraints to prevent the insertion of invalid data into tables. This chapter mainly introduces the types and application scenarios of integrity constraints.
The purpose of integrity constraints is to ensure that the information stored in the database adheres to specific business rules. For example, if the execution result of a DML statement violates an integrity constraint, the statement will be rolled back and an error message will be returned.
Operations performed on synonyms of views and tables must comply with the integrity constraints defined on the base tables.
For example, assume that a user defines an integrity constraint on the salary column of the employees table, specifying that rows with a numeric value greater than 10000 cannot be inserted into the table. If an INSERT or UPDATE statement violates this integrity constraint, the statement will be rolled back and an error message will be returned.