2.2.3 Validation Usage
When inserting
Mandatory. Default= Always apply rule (ADD)
Specify database operation when the rule is to be performed.
Rules
Allowable values are:
Always apply rule (ADD)
|
Rule is always evaluated when information is added (inserted) to the database.
|
Apply when column is used (ADDUSE)
|
Rule is only evaluated when the column is actually specified in the INSERT command being executed.
|
Never apply rule
|
Do not apply rule when inserting to the table.
|
|
When updating
Mandatory. Default= Always apply rule (CHG)
Specify database operation when the rule is to be performed.
Rules
Allowable values are:
Always apply rule (CHG)
|
Rule is always evaluated when information is changed (updated) in the database.
|
Apply when column is used (CHGUSE )
|
Rule is only evaluated when the column is actually specified in the UPDATE command being executed.
|
Never apply rule
|
Do not apply rule when updating the table.
|
|
When deleting
Mandatory. Default= Never apply rule
Specify database operation when the rule is to be performed.
Rules
Allowable values are:
Always apply rule (DLT)
|
Rule is always evaluated when information is deleted (removed) from the database.
|
Never apply rule
|
Do not apply rule when deleting from the table.
|
|
Tips & Techniques
- Most commonly used entries are ADD, CHG and CHGUSE.
- Use of DLT by itself is a common and a very powerful rule mechanism.
- If ADDUSE is specified, ensure that the default value of the column is a valid database value.
- Use caution when specifying CHGUSE with a rule that involves multiple columns, because the check will only be done when the column linked to the rule is specified on an UPDATE command, and not done when it is omitted, regardless of whether or not any of the other columns referenced in the rule are specified.
Also See
2.2.4 Define Rules (by type)