7. Embedded QUEL for Pascal : Pascal Variables and Data Types : Variable Usage
 
Share this page                  
Variable Usage
Pascal variables declared to EQUEL can substitute for most elements of EQUEL statements that are not keywords. Of course, the variable and its data type must make sense in the context of the element. To use a Pascal variable in an EQUEL statement, just use its name. To refer to an element, such as a database column, with the same name as a variable, dereference the element by using the EQUEL dereferencing indicator (#). As an example of variable usage, the following retrieve statement uses the variables "namevar" and "numvar" to receive data, and the variable "idnovar" as an expression in the where clause:
##  retrieve (namevar = e.name, numvar = e.num)
##          where e.idno = idnovar;
You should not use the Pascal type-cast operator (::) in EQUEL statements. The preprocessor ignores it and does not change the type of the variable.
If, in retrieving from Ingres into a program variable, no value is returned for some reason (for example, no rows qualified in a query), the variable will not be modified.
Various rules and restrictions apply to the use of Pascal variables in EQUEL statements. The sections below describe the usage syntax of different categories of variables and provide examples of such use.