SQL$HELP_OLD72.HLB  —  END_DECLARE, Examples
    Example 1: Declaring a host language variable within a
    BEGIN . . . END DECLARE block

    The following example shows portions of a PL/I 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
    PL/I.

    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;
      DECLARE LNAME char(20);
    EXEC SQL
    END DECLARE SECTION;
    .
    .
    .
    EXEC SQL
    SELECT FIRST_NAME
       INTO :LNAME
       FROM EMPLOYEES
       WHERE EMPLOYEE_ID = "00164";
Close Help