Delimits the beginning of a host language variable declaration section in a precompiled program.
1 – Environment
You can use the BEGIN 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 host language variable declarations.
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 should 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
A variable declaration embedded in a program. See the Parameters HELP topic for full details on host language variable definitions.
4 – 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";