17.00 - assignment_statement - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Advanced SQL Engine
Teradata Database
Release Number
September 2020
Content Type
Programming Reference
Publication ID
English (United States)

The SET statement.

See Teradata Vantage™ - SQL Stored Procedures and Embedded SQL , B035-1148 for details.

You can specify these options for assignment statements.

A keyword introducing the SET statement used for assigning a value to a variable or parameter.
You can assign a UDT expression to a UDT variable or parameter; however, the mutator SET clause syntax (see UPDATE in Teradata Vantage™ - SQL Data Manipulation Language, B035-1146 for details about mutator SET clause syntax) is not supported within a SET statement. The workaround for this is to use the standard non-mutator SET clause format, with the column reference on one side of the equal sign and a UDT expression containing the appropriate mutators on the other side.
Name of the variable or parameter to be assigned a value.
If you are assigning to a parameter, it cannot be an IN parameter.
If you are assigning to any variable, it cannot be named QUERY_BAND.
You cannot set values for status variables in SQL procedures.
Arithmetic and string expressions that contain the value to be assigned to a variable.
SQL procedure local variables, status variables, IN or INOUT parameters, and FOR loop column and correlation names can be specified in the assignment_source, which is also known as a value expression.