IBM Books

SQL Reference

INCLUDE

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

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 ]