SQL Reference
The INCLUDE statement inserts declarations into a source program.
Invocation
This statement can only be embedded in an application program. It is
not an executable statement.
Authorization
None required.
Syntax
>>-INCLUDE----+-SQLCA-+----------------------------------------><
+-SQLDA-+
'-name--'
Description
- SQLCA
- Indicates the description of an SQL communication area (SQLCA) is to be
included. For a description of the SQLCA, see Appendix B, SQL Communication Area (SQLCA).
- SQLDA
- Indicates the description of an SQL descriptor area (SQLDA) is to be
included. For a description of the SQLDA, see Appendix C, SQL Descriptor Area (SQLDA).
- name
- Identifies an external file containing text that is to be included in the
source program being precompiled. It may be an SQL identifier without a
filename extension or a literal in single quotes (' '). An SQL
identifier assumes the filename extension of the source file being
precompiled. If a filename extension is not provided by a literal in
quotes then none is assumed.
For host language specific information, see the Application Development Guide.
Notes
- When a program is precompiled, the INCLUDE statement is replaced by source
statements. Thus, the INCLUDE statement should be specified at a point
in the program such that the resulting source statements are acceptable to the
compiler.
- The external source file must be written in the host language specified by
the name. If it is greater than 18 characters or contains
characters not allowed in an SQL identifier then it must be in single
quotes. INCLUDE name statements may be nested though not
cyclical (for example, if A and B are modules and A contains an INCLUDE
name statement, then it is not valid for A to call B and then B to
call A).
- When the LANGLEVEL precompile option is specified with the SQL92E value,
INCLUDE SQLCA should not be specified. SQLSTATE and SQLCODE variables
may be defined within the host variable declare section.
Example
Include an SQLCA in a C program.
EXEC SQL INCLUDE SQLCA;
EXEC SQL DECLARE C1 CURSOR FOR
SELECT DEPTNO, DEPTNAME, MGRNO FROM TDEPT
WHERE ADMRDEPT = 'A00';
EXEC SQL OPEN C1;
while (SQLCODE==0) {
EXEC SQL FETCH C1 INTO :dnum, :dname, :mnum;
(Print results)
}
EXEC SQL CLOSE C1;
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
[ DB2 List of Books |
Search the DB2 Books ]