G-3170: Always use DEFAULT ON NULL declarations to assign default values to table columns if you refuse to store NULL values.
Major
Reliability
Unsupported in db* CODECOP Validators
We cannot identify column default values. Requires create table
and alter table
parser support or access to the Oracle Data Dictionary.
Restriction
Oracle Database 12c
Reason
Default values have been nullifiable until Oracle Database 12c. Meaning any tool sending null as a value for a column having a default value bypassed the default value. Starting with Oracle Database 12c default definitions may have an on null
definition in addition, which will assign the default value in case of a null
value too.
Example (bad)
1 2 3 4 5 6 7 8 9 |
|
1 2 3 4 5 |
|
Example (good)
1 2 3 4 5 6 7 8 9 |
|
1 2 3 4 5 |
|