Using Scalar Subqueries in INSERT 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

Using Scalar Subqueries in INSERT Requests

The following rules and restrictions apply to specifying scalar subqueries in INSERT and INSERT … SELECT requests:

  • You can specify a scalar subquery as a parameterized value in the value list of a simple INSERT request, but Teradata Database always interprets it as a noncorrelated scalar subquery (see “Example: INSERT Using a Scalar Subquery” on page 388).
  • You cannot specify a noncorrelated scalar subquery as a value in a value list that is assigned to an identity column in a simple INSERT request.
  • You can specify an INSERT request with scalar subqueries in the body of a trigger.
  • However, you cannot specify a simple INSERT request with a scalar subquery in its value list in the body of a row trigger.

  • You can specify a scalar subquery in the SELECT component of an INSERT … SELECT request.
  • Teradata Database processes any noncorrelated scalar subquery specified in the SELECT component of an INSERT … SELECT in a row trigger as a single‑column single‑row spool instead of as a parameterized value.