Previous Topic: INCLUDE TABLE DirectiveNext Topic: Local Variables and Routine Parameters


Referring to Host Variables

Reference Requirements

These syntax requirements apply when you refer to a host variable in an embedded SQL statement:

Reference Example

In the following example, information from the BENEFITS table is selected for a given employee ID value, which the program has assigned to the host variable EMP-ID. BENEFITS table information is retrieved into host variables VAC-TAKEN and SICK-TAKEN. VAC-TAKEN-I and SICK-TAKEN-I are indicator variables.

EXEC SQL
   SELECT VAC_TAKEN,
          SICK_TAKEN
     INTO :VAC-TAKEN INDICATOR :VAC-TAKEN-I,
          :SICK-TAKEN INDICATOR :SICK-TAKEN-I
     FROM BENEFITS
     WHERE EMP_ID = :EMP-ID
END-EXEC.