6. QUEL and EQUEL Statements : Range Statement--Associate Range Variables with Tables : Description
 
Share this page                  
Description
A range statement associates a range variable with the table or view specified by tablename. A range declaration remains in effect until:
The session ends, or
The variable is redeclared by another range statement, or
Its table or view definition is destroyed
Not all range variables are declared using the range statement: the table name you specify in a retrieve statement is considered to be an implicit or default range variable.
Range variables enable you to treat the same table as though it were two separate tables. In the following example, range variables "e" and "m" allow you to extract employees and their managers from the same table.
range of d is dept
range of e is employee
range of m is employee
retrieve (e.ename, mgr=m.ename)
where e.dept=d.dno and d.mgr=m.eno