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

Teradata Vantage™ - SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1146-175K
Language
English (United States)
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.