Inserting When Using a DEFAULT Function - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
The following rules apply when using a DEFAULT function to insert rows into a table:
  • The DEFAULT function takes a single argument that identifies a relation column by name. The function evaluates to a value equal to the current default value for the column. For cases where the default value of the column is specified as a current built-in system function, the DEFAULT function evaluates to the current value of system variables at the time the request runs.

    The resulting data type of the DEFAULT function is the data type of the constant or built-in function specified as the default unless the default is NULL. If the default is NULL, the resulting date type of the DEFAULT function is the same as the data type of the column or expression for which the default is being requested.

  • The DEFAULT function can be specified as DEFAULT or DEFAULT (column_name). When no column name is specified, the system derives the column based on context. If the column context cannot be derived, the request stops and an error is returned to the requestor.
  • The DEFAULT function without a column name can be specified in the expression list. If the INSERT request has a column list specified, the column name for the DEFAULT function is the column in the corresponding position of the column list. If the request does not have a column name list, the column name is derived from the position in the VALUES list.
  • The DEFAULT function without a column name in the INSERT request must be specified as a standalone element, not in an expression. This form of usage is ANSI compliant.
  • The DEFAULT function with a column name can be specified in an expression list. This is a Teradata extension to ANSI.
  • The DEFAULT function with a column name can be specified anywhere in the expression. This is a Teradata extension.
  • When there is no explicit default value associated with the column, the DEFAULT function evaluates to null.