Local Variables

A local variable is a variable that is defined in an SQL routine. You use local variables to temporarily store and retrieve values as needed in the logic of the routine. Local variables are used for such things as:
idmscu
A local variable is a variable that is defined in an SQL routine. You use local variables to temporarily store and retrieve values as needed in the logic of the routine. Local variables are used for such things as:
  • Retrieving data from a CA IDMS database by specifying them on the INTO clause of a SELECT statement
  • Passing data to and from other SQL-invoked routines by specifying them as arguments on the routine invocation
  • Holding computational values by specifying them as a target of a SET statement or as values within expressions.
Local variables can only be referenced within the body of the SQL routine in which they are defined.
Declaring Local Variables
A local variable is defined by a
variable-declaration
statement that is included in a Compound Statement within an SQL routine body. The declaration of a local variable consists of the specification of its name, data type, and optionally its initial value.