LET
The LET statement assigns values to variables.
Syntax
LET target = expr [,...] - target is the name of the variable to be assigned.
- expr is any valid expression supported by the language.
Usage
The LET statement
assigns a value to a variable, or a set of values to all members
of a RECORD by using the .* notation.
The runtime system applies data type conversion rules if the data type of expression does not correspond to the data type of target.
When assigning a numeric of date/time value to a character string variable, the values are formatted for display (for example, the numeric data is right-aligned).
When specifying a comma-separated list of expressions for the
right operand, the LET statement concatenates
all expressions together. Unlike the || operator,
if an expression in the comma-separated list evaluates to
NULL, the concatenation result will not be null,
except if all expressions to the right of the equal sign are
null.
The target variable can be record followed by dot +
star (record.*), to reference all record
members of the record. In this case, the right operand must also be
a record using this notation, and all members will be assigned
individually.
Variables defined with a complex data type
(like TEXT or BYTE) can
only be assigned to NULL.
Example
SCHEMA stores
MAIN
DEFINE c1, c2 RECORD LIKE customer.*
-- Single variable assignment
LET c1.customer_num = 123
-- Complete RECORD assignment
LET c1.* = c2.*
END MAIN