Previous Topic

Next Topic

Include

Valid in: ESQL

The Include statement incorporates external files into your program's source code.

Previous Topic

Next Topic

Syntax

The Include statement has the following format:

EXEC SQL INCLUDE filename | SQLCA | SQLDA;

Previous Topic

Next Topic

Description

The Include statement is typically used to include variable declarations, although it is not restricted to such use. When used to include variable declarations, it must be inside an embedded SQL declaration section.

Note: The file generated by dclgen must be specified using the include statement. For details about dclgen, see the Embedded SQL Companion Guide.

The file specified by the SQL include statement must contain complete statements or declarations. For example, it is illegal to use include in the following manner, where the file, predicate, contains a common predicate for select statements:

exec sql select ename
       from employee
       where
       exec sql include 'predicate';

Filename must be a quoted string constant specifying a file name or a logical or environment variable that contains a file name. If a file name is specified without an extension, the DBMS Server assumes the default extension of your host language.

The specified file can contain declarations, host language statements, embedded SQL statements, and nested includes. When the original source file is preprocessed, the include statement is replaced by a host language include directive, and the included file is also preprocessed.

There are two special instances of the include statement:

Both these statements must be placed outside all declaration sections, preferably at the start of the program. The statement must be terminated as required by the rules of your host language.

Previous Topic

Next Topic

Permissions

All users are permitted to use this statement.

Previous Topic

Next Topic

Related Statements

Declare

Previous Topic

Next Topic

Examples: Include

The following are Include statement examples:

  1. Include the SQLCA in the program.

    exec sql include sqlca;

  2. Include global variables.

    exec sql begin declare section;
               exec sql include 'global.var';
         exec sql end declare section;


© 2007 Ingres Corporation. All rights reserved.