The Assignment statement is used to assign a new value to a declared variable.
[SET] variable_name = expr;
The expr is evaluated and the result of the evaluation is assigned to the variable. The SET keyword is optional.
The data type of the expr must match the data type of the variable. The variable_name must be declared at the beginning of the script.
Range checking is performed on numeric data. If the value to be assigned to is outside of the range, an ADS_SCRIPT_EXCEPTION exception with the error code 2227 (ERR_SCRIPTOUTOFRANGE) will be raised.
DECLARE strLocal String;
DECLARE str2 String;
DECLARE acVar3 Char(20), dtVal Date;
strLocal = 'abc';
SET str2 = strLocal + 'def';
acVar3 = str2 + strLocal;
SET dtVal = ( SELECT dob FROM employees WHERE empid = 1 );