SQL iQuery Script Built-in Function



Is the specified iQuery Script Session Variable Defined?

The ISDEFINED() built-in functions returns true if the SQL iQuery Script Session Variable exists. If the variable exists, this function returns true regardless of whether the variable contains any data.


The ISDEFINED() built-in function returns true if the iQuery Script Session Variable exists for this script. If the variable exists and is empty it returns true. If the variable exists and contains a value it returns true. If the variable was never defined, it returns false.


  1. The name of an iQuery Session Varaible

#default &Company = 01
#define &reg = ''

if defined(&reg);
#h2 Region &Reg
if NOT defined(&Company);
#msg Company is undefined
select * from foo;

The two Session Variables &COMPANY and &REG are declared. &COMPANY is initialized to 01, while &REG is empty. The IF DEFINED(&REG) returns true because &REG is defined although it contains no value. The IF NOT DEFINED(&COMPANY) will return false because &COMPANY was initialized to 01.

See the isEmpty() built-in function which provided similar but additional functionality.