Default Clause - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

DEFAULT Clause

"Examples of DEFAULT"
The DEFAULT option of the CREATE TABLE or ALTER TABLE table-name ADD COLUMN
statement specifies a default value for a column being created. The default value is used when
a row is inserted in the table without a value for the column.
DEFAULT default | NO DEFAULT | identity-column-specification
default is:
literal
| NULL
| CURRENT_DATE
| CURRENT_TIME
| CURRENT_TIMESTAMP
identity-column-specification is:
GENERATED BY DEFAULT AS IDENTITY
| GENERATED ALWAYS AS IDENTITY
NO DEFAULT
specifies the column has no default value. You cannot specify NO DEFAULT in an ALTER
TABLE statement. See
DEFAULT literal
is a literal of a data type compatible with the data type of the associated column.
For a character column, literal must be a string literal of no more than 240 characters or
the length of the column, whichever is less. The maximum length of a default value for a
character column is 240 bytes (minus control characters) or the length of the column, whichever
is less. Control characters consist of character set prefixes and single quote delimiter found
in the text itself.
For a numeric column, literal must be a numeric literal that does not exceed the defined
length of the column. The number of digits to the right of the decimal point must not exceed
the scale of the column, and the number of digits to the left of the decimal point must not
exceed the number in the length (or length minus scale, if you specified scale for the column).
For a datetime column, literal must be a datetime literal with a precision that matches
the precision of the column.
For an INTERVAL column, literal must be an INTERVAL literal that has the range of
INTERVAL fields defined for the column.
DEFAULT NULL
specifies NULL as the default. This default can occur only with a column that allows null.
DEFAULT CURRENT_DATE
specifies the default value for the column as the value returned by the CURRENT_DATE
function at the time of the operation that assigns a value to the column. This default can occur
only with a column whose data type is DATE.
DEFAULT CURRENT_TIME
specifies the default value for the column as the value returned by the CURRENT_TIME
function at the time of the operation that assigns a value to the column. This default can occur
only with a column whose data type is TIME.
DEFAULT CURRENT_TIMESTAMP
specifies the default value for the column as the value returned by the
CURRENT_TIMESTAMP function at the time of the operation that assigns a value to the
column. This default can occur only with a column whose data type is TIMESTAMP.
314
SQL Clauses
"ALTER TABLE Statement" (page
44).

Advertisement

Table of Contents
loading

Table of Contents