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
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.
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.
identity-column-specification
indicates that a particular column is an IDENTITY column. GENERATED BY DEFAULT
indicates that the system will generate values for this column by default.
258
SQL Clauses
"ALTER VIEW Statement" (page
51).

Advertisement

Table of Contents
loading

Table of Contents