Application Programming Interface Guide > Built-in Procedures > Procedures Reference > SetEnvironment
 
SetEnvironment
Set an environment variable to a value.
Location
/lib/util/
Syntax
setEnvironment (IN variableName VARCHAR (40),
IN propValue VARCHAR (2048))
Inputs
variableName: The name of a variable. Variable names are not case-sensitive. For example, both sample and SAMPLE are the same variable.
value: The new value for the variable.
Input Variable Names and Values
Note: Environment variables starting with System. are system-defined and may have restricted sets of legal values.
All built-in variable names are available on the Constants tab of the /lib/util/System SQL definition set. The variable names and their legal values are:
System.CASE_SENSITIVE_IN_COMPARISONS: TRUE or FALSE. Reflects the case sensitivity being used in string comparisons for SQL and SQL script operations in this scope.
System.IGNORE_TRAILING_SPACES_IN_COMPARISONS: TRUE or FALSE. Reflects whether or not trailing spaces are ignored in string comparisons for SQL and SQL script operations in this scope.
System.NUM_ROWS_AFFECTED: A numeric value.
System.TRIGGER_EVENT_NAME: The trigger name if the current request is the result of a trigger. NULL otherwise.
System.TRIGGER_EVENT_TYPE: The trigger type if the current request is the result of a trigger. NULL otherwise.
System.TRIGGER_EVENT_VALUE: The trigger value if the current request is the result of a trigger. NULL otherwise.
System.TRIGGER_PATH: A path if the current request is the result of a trigger. NULL otherwise.
For backward compatibility, the following are also accessible without the System. prefix:
CASE_SENSITIVE_IN_COMPARISONS
IGNORE_TRAILING_SPACES_IN_COMPARISONS
NUM_ROWS_AFFECTED
TRIGGER_EVENT_NAME
TRIGGER_EVENT_TYPE
TRIGGER_EVENT_VALUE
TRIGGER_PATH
Outputs
N/A
Exceptions
IllegalArgumentException: If an unsupported variable name is requested.
IllegalArgumentException: If an illegal value is set to a variable.
Example
PROCEDURE proc7()
BEGIN
DECLARE x VARCHAR(4096);
CALL getEnvironment('NUM_ROWS_AFFECTED', x);
CALL log(x);
SET x = '100';
CALL setEnvironment('NUM_ROWS_AFFECTED', x);
CALL getEnvironment('NUM_ROWS_AFFECTED', x);
CALL log(x);
END