Rules for Using the DEFAULT Function With MERGE Requests - 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

Rules for Using the DEFAULT Function With MERGE Requests

The following rules apply when using a DEFAULT function within a MERGE request:

  • 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.

  • You can specify the DEFAULT function as DEFAULT or DEFAULT (column_name). When a column name is not 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 the rules listed for the UPDATE statement also apply to the UPDATE in a MERGE statement. See “Rules for Using the DEFAULT Function With Update” on page 483.
  • All the rules listed for the INSERT statement also apply to the INSERT in a MERGE statement. See “Inserting When Using a DEFAULT Function” on page 361.
  • When the SQL Flagger is enabled, a DEFAULT function specified with a column name argument for inserts or updates is flagged as a Teradata extension.
  • For more information about the DEFAULT function, see SQL Functions, Operators, Expressions, and Predicates.