Firebird Maestro online Help
Prev | Return to chapter overview | Next |
Checks
A check constraint is the most generic constraint type. It allows you to specify that the value in a certain column must satisfy a Boolean (truth-value) expression.
The Check Properties editor allows you to add a new check constraint or edit an existing one. This dialog can be invoked from Table Editor, or via the popup menu of the corresponding nodes of the explorer tree.
Checks are created within Check Properties. In order to run the wizard you should either
or
or
|
Checks are edited within the Check Properties dialog window. In order to open the dialog you should either
or
You can change the name of the check using the Rename Check dialog. To open the dialog you should either
or
|
To drop the check:
or
and confirm dropping in the dialog window.
|
Name
The name of the check constraint.
Condition
Specify an expression producing a Boolean result which new or updated rows must satisfy for an insert or update operation to succeed. Expressions evaluating to True or Unknown succeed. In case any row of an insert or update operation produce a FALSE result an error exception is raised and the insert or update does not alter the database.
For example, you can specify the following condition for check, if you want to control the inserted salary value.
salary >= (SELECT min_salary FROM job WHERE
job.job_code = employee.job_code AND
job.job_grade = employee.job_grade AND
job.job_country = employee.job_country) AND
salary <= (SELECT max_salary FROM job WHERE
job.job_code = employee.job_code AND
job.job_grade = employee.job_grade AND
job.job_country = employee.job_country)