DB2 10.5 for Linux, UNIX, and Windows

INCLUDE statement

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

Read syntax diagramSkip visual syntax diagram
>>-INCLUDE--+-SQLCA-+------------------------------------------><
            +-SQLDA-+   
            '-name--'   

Description

SQLCA
Indicates the description of an SQL communication area (SQLCA) is to be included.
SQLDA
Indicates the description of an SQL descriptor area (SQLDA) is to be included.
name
Identifies an external file containing text that is to be included in the source program being precompiled. It can be an SQL identifier without a file name extension or a literal enclosed by single quotation marks (' '). An SQL identifier assumes the filename extension of the source file being precompiled. If a file name extension is not provided by a literal enclosed by quotation marks, none is assumed.

Notes

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;