DEFAULTIF (fieldSelection)
You can use multiple DEFAULTIF clauses for a variety of different conditions and different default values. The product checks the conditions in the specified order and selects the result based on the first matching condition.
Defaultifvalue selection
In a DEFAULTIF statement, you can specify a default VALUE value that overrides any Db2 default values specified for the column when the table was created.
Value specification syntax
VALUE values
Value | Description |
---|---|
constant | A constant |
special register | A special register |
SQL-constant expression | An SQL expression involving constants, or special registers, or both |
NULL | Equivalent to a NULLIF clause |
For more information about SQL constant and special register, see BMC-AMI-Utilities-SQL-language.
Examples
The following table describes default values that BMC AMI Load generates when a DEFAULTIF condition is true and the column has no default value specified in the Db2 catalog:
Column type | Default value |
---|---|
Character or graphic | Blank |
Numeric | 0 |
Date | Current date |
Time | Current time |
Timestamp | Current time stamp |
The current date, time, and timestamp values are recomputed for each inserted row and therefore results might not be the same across the entire table.