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

SQL Data Manipulation Language

Product
Teradata Database
Release Number
15.10
Language
English (United States)
Last Update
2018-10-06
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata® Database

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” on page 483 also apply for an update in the upsert form of the UPDATE statement.
  • All of the rules listed in “Inserting When Using a DEFAULT Function” on page 361 also apply for an insert in the upsert form of the UPDATE statement.
  • See SQL Functions, Operators, Expressions, and Predicates for more information about the DEFAULT function.