SET
Purpose
The SET command assigns a data type and a value to a utility variable. Variables need not be declared in advance to be the object of the SET command. If a variable does not already exist, the SET command creates it.
The SET command also dynamically changes the data type to that of the assigned value if it has already been defined. Variables used to the right of TO in the expression must have already been defined.
Syntax
where
Syntax Element |
Description |
var |
Name of the utility variable which is set to the evaluated expression following it |
expression |
Value and data type to which the utility variable is to be set |
Usage Notes
The utility variable can be substituted wherever substitution is allowed.
If the expression evaluates to a numeric value, the symbol is assigned an integer value, as in:
.SET FOONUM TO ‑151 ;
If the expression is a quoted string, the symbol is assigned a string value, as in:
.SET FOOCHAR TO '‑151' ;
The minimum and maximum limits for Floating Point data types are as follows:
4.0E‑75 <=abs(float variable)<7.0E75
Example
Teradata TPump supports concatenation of variables, using the SET command, such as:
.SET C TO 1;
.SET D TO 2;
.SET X TO &C.&D;
Example
In this example, X evaluates to 12. If a decimal point is added to the concatenated variables, as in:
.SET C TO 1;
.SET D TO 2;
.SET X TO &C..&D;
X then evaluates to 1.2.