Was this helpful?
DECLARE TABLE
Valid in: ESQL
The DECLARE TABLE statement describes the characteristics of a database table.
The DECLARE TABLE statement has the following format:
EXEC SQL DECLARE [schema.]tablename TABLE
          (column_name data_type [WITH NULL | NOT NULL [WITH DEFAULT]]
          {, column_name data_type})
The DECLARE TABLE statement lists the columns and data types associated with a database table, for the purpose of program documentation. The DECLARE TABLE statement is a comment statement inside a variable declaration section and is not an executable statement. You cannot use host language variables in this statement.
The dclgen utility includes a DECLARE TABLE statement in the file it generates while creating a structure corresponding to a database table. For details, see the Embedded SQL Companion Guide.
The embedded SQL preprocessor does not generate any code for the DECLARE TABLE statement. Therefore, in a language that does not allow empty control blocks (for example, COBOL, which does not allow empty IF blocks), the DECLARE TABLE statement must not be the only statement in the block.
Permissions
This statement is available to all users.
Last modified date: 08/28/2024