SQL$HELP_OLD72.HLB  —  BEGIN_DECLARE, Example
    Example 1: Declaring a host language variable within BEGIN . . .
    END DECLARE statements

    The following example shows portions of a Pascal program. The
    first part of the example declares the host language variable
    LNAME within the BEGIN DECLARE and END DECLARE statements. The
    semicolon is necessary as a terminator because the language is
    Pascal.

    The second part of the example shows a singleton SELECT statement
    that specifies a one-row result table. The statement assigns
    the value in the row to the previously declared host language
    variable LNAME.

    EXEC SQL BEGIN DECLARE SECTION;
      LNAME: packed array [1..20] of char;
    EXEC SQL END DECLARE SECTION;
    .
    .
    .

    EXEC SQL
    SELECT FIRST_NAME
       INTO :LNAME
       FROM EMPLOYEES
       WHERE EMPLOYEE_ID = "00164";
Close Help