SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
D-26
DEFAULT Clause
DEFAULT Clause
The DEFAULT clause specifies a default value for a column (a value to use as the
value of the column when a row is inserted without one). You can specify a default
value for any column you define with CREATE TABLE or ALTER TABLE.
The default is NULL.
literal
is a literal of a data type compatible with the data type defined for the associated
column.
For a character column, literal must be a string literal of no more than eight
bytes or the length of the column, whichever is less. If the character column is
associated with a double-byte character set, literal must contain an even
number of bytes. SQL pads literal with spaces (HEX 20) when inserting the
value into longer character fields. (SQL always uses HEX 20 for padding, whether
a single-byte or double-byte character set is associated with the expression.)
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 date-time column, literal must be a date-time 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.
CURRENT
(date-time columns only) specifies that the default value for the column is the
appropriate portion of the Guardian timestamp at the time of the operation that
assigns a value to the column.
If more than one date-time column is assigned a CURRENT default value in the
same operation, SQL uses the same timestamp as the basis of all CURRENT
values assigned in the operation, regardless of how long the operation takes.
{ literal }
DEFAULT { CURRENT }
{ SYSTEM }
{ NULL }