DEFAULT specification(default_spec)
A DEFAULT specification is formed by specifying the keyword DEFAULT and a DEFAULT value. The maximum length of a default value is 254 characters.
Syntax
<default_spec> ::= DEFAULT <literal> | DEFAULT NULL
| DEFAULT USER | DEFAULT USERGROUP
| DEFAULT DATE | DEFAULT TIME | DEFAULT TIMESTAMP
| DEFAULT TRUE | DEFAULT FALSE
| DEFAULT TRANSACTION | DEFAULT STAMP
| DEFAULT SERIAL[(<unsigned_integer>)]
Explanation
If a DEFAULT specification has been made for a column, the default value (
<literal> , NULL , USER ,...) must be a value that can be inserted in the column.DEFAULT specification |
Explanation |
DEFAULT <literal> |
The literal must be comparable with the data type of the column. |
DEFAULT USER |
Supplies the user name of the current user and can only be specified for columns of the data type [VAR]CHAR(n) (n>=32). |
DEFAULT USERGROUP |
Supplies only members of a usergroup, the usergroup name, or the user name for users that do not belong to a usergroup. This DEFAULT specification can only be specified for columns of the data type [VAR]CHAR(n) (n>=32). |
DEFAULT DATE |
Supplies the current date and can only be specified for columns of the data type DATE. |
DEFAULT TIME |
Supplies the current time and can only be specified for columns of the data type TIME. |
DEFAULT TIMESTAMP |
Supplies the current timestamp and can only be specified for columns of the data type TIMESTAMP. |
DEFAULT TRUE/DEFAULT FALSE |
Can only be specified for columns of the data type BOOLEAN. |
DEFAULT TRANSACTION |
Supplies the identification of the current transaction and can only be specified for columns of the data type CHAR(n) BYTE (n>=8). |
DEFAULT STAMP |
Supplies a value of eight characters in length that is unique within the database system and can only be specified for columns of the data type CHAR(n) BYTE (n>=8). If a table is defined without a key column, the database system implicitly creates a key column SYSKEY CHAR(8) BYTE. The key values in the SYSKEY column are only unique within a table; i.e., the SYSKEY column in two different tables may contain the same values. If a unique key is desired across the entire database system, a key column can be defined with the DEFAULT specification STAMP. |
DEFAULT SERIAL [(<unsigned_integer)] |
Supplies a number generator for positive integers and can only be specified for columns of the data type INTEGER, SMALLINT, and FIXED without decimal places ( SERIAL).The first value generated by the generator can be defined by specifying an unsigned integer (must be greater than 0). If this definition is missing, 1 is defined as the first value. If the value 0 is inserted in this column by an INSERT statement, the current number generator value is supplied and not the value 0. Each table may not contain more than one column with the DEFAULT specification DEFAULT SERIAL. |