Using UPDATE (Upsert Form) with the DEFAULT Function - Advanced SQL Engine - Teradata Database

SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
qtb1554762060450.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata Vantage™
The following rules apply to using the DEFAULT function with the upsert form of UPDATE:
  • 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 is executed.

    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 has two forms. It 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 aborts and an error is returned to the requestor.
  • All of the rules listed in Rules for Using the DEFAULT Function With Update also apply for an update in the upsert form of the UPDATE statement.
  • All of the rules listed in Inserting using the DEFAULT Function Option, the DEFAULT VALUES Option, or Without Specifying a Value also apply for an insert in the upsert form of the UPDATE statement.

See Teradata Vantage™ - SQL Functions, Expressions, and Predicates, B035-1145 for more information about the DEFAULT function.