Application Programming Interface Guide > Built-in Procedures > Procedures Reference > GetEnvironment
 
GetEnvironment
Get the value of an environment variable from the last operation.
Note: These environment variables are local to individual procedure executions; they are not global.
All built-in variable names are available on the Constants tab of the /lib/util/System SQL definition set. The variable names 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: Path if the current request is result of a trigger. NULL otherwise.
System.CACHED_RESOURCE_PATH: The path to the resource whose cache is being refreshed, if the current request is the result of a cache refresh callback. NULL otherwise.
System.CACHED_RESOURCE_TYPE: The type of the resource whose cache is being refreshed, if the current request is the result of a cache refresh callback. NULL otherwise.
System.CACHED_RESOURCE_PARAM_KEY: The parameter key of the resource whose cache is being refreshed, if the current request is the result of a cache refresh callback. NULL otherwise.
System.CACHE_DATASOURCE_PATH: The path of the cache data source, if the current request is the result of a cache refresh callback. NULL otherwise.
System.CACHED_RESOURCE_CACHE_KEY: The cache key used by cache refresh, if the current request is the result of a cache refresh callback. NULL otherwise.
System.CACHED_RESOURCE_BUCKET_PATH: The path of the cache table used by cache refresh, if (1) the current request is the result of a cache refresh callback, and (2) the cache refresh mode is one table per snapshot (OTPS). NULL otherwise.
System.CACHED_RESOURCE_REFRESH_OUTCOME: The outcome of the cache refresh, if the current request is the result of a cache refresh callback. NULL otherwise. TRUE for success, FALSE for failure and NULL for unknown.
System.CACHED_RESOURCE_ERROR_MESSAGE: The error message generated by the cache refresh, if the current request is the result of a cache refresh callback and the cache refresh failed. 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
Location
/lib/util/
Syntax
getEnvironment (IN variableName VARCHAR (40),
OUT 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.
Outputs
propValue: The value stored in the variable, or NULL if no value is stored.
Example
PROCEDURE proc4()
BEGIN
PATH /shared/sources/scripts;
DECLARE x VARCHAR(4096);
 
CALL insertProc(); -- This procedure is in the PATH
CALL getEnvironment('NUM_ROWS_AFFECTED', x);
CALL log(x);
END