Delimits the end of a host language variable declaration section in a precompiled program.
1 – Environment
You can use the END DECLARE statement embedded in host language programs to be precompiled.
2 – Format
(B)0[m[1;4mEXEC[m[1m [1;4mSQL[m[1m qq> [1;4mBEGIN[m[1m [1;4mDECLARE[m[1m [1;4mSECTION[m[1m qq> ; qqqk [m [1mlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj [m [1mmqwq> <host language variable declaration> qwqk [m [1m mqqqqqqqqq<qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x [m [1mlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj [m [1mmq> [1;4mEXEC[m[1m [1;4mSQL[m[1m qq> [1;4mEND[m[1m [1;4mDECLARE[m[1m [1;4mSECTION[m[1m qq> ; [m [1m [m
3 – Arguments
3.1 – BEGIN_DECLARE_SECTION
Delimits the beginning of a host language variable declaration.
3.2 – END_DECLARE_SECTION
Delimits the end of host language variable declarations.
3.3 – ;_(semicolon)
Terminates the BEGIN DECLARE and END DECLARE statements. Which terminator you use depends on the language in which you are embedding the host language variable. The following table shows which terminator to use: Required SQL Terminator END BEGIN DECLARE DECLARE Host Language Statement Statement COBOL END-EXEC END-EXEC FORTRAN None required None required Ada, C, Pascal, or ; (semicolon) ; (semi- PL/I colon)
3.4 – host_language_variable_declaration
Specifies a variable declaration embedded within a program. See the User_Supplied_Names HELP topic for more information on host language variable definitions.
4 – 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";