DECLARE TABLE

The DECLARE TABLE statement (embedded SQL only) is used for application program documentation and providing the precompiler with information for checking embedded SQL statements.

Invocation

DECLARE TABLE is not an executable statement. It can only be embedded in an application language.

Authorization

None required.

Syntax

This command is supported only syntactically.

DECLARE {table-name | view-name} 
    TABLE (column-name {built-in-data-type | distinct-type-name}
    [NOT NULL] 
    [NOT NULL WITH DEFAULT] [,...])

This command is supported only syntactically.

DECLARE {table-name | view-name} 
    TABLE (column-name {built-in-data-type | distinct-type-name}
    [NOT NULL] 
    [NOT NULL WITH DEFAULT] [,...])

Parameters:

table-name or view-name Is the name of the table or view you want to document. If the table is defined in your application program, the description of the table in the SQL statement in which it is defined (for example, CREATE TABLE or DECLARE GLOBAL TEMPORARY TABLE statement) and the DECLARE TABLE statement must be identical.
column-definition One or more column definitions (separated by commas) can be chosen as specified below:
column-name data-type [NOT NULL] 
[NOT NULL WITH DEFAULT]

Description

The XDB Server supports the DECLARE TABLE command syntactically only. The VALIDATE directive can be used to achieve the same functionality when precompiling. Use the Declaration Generator utility to generate declarations for tables and views. Mainframe DB2 users should use the DCLGEN utility.

built-in-data-type

Is the built-in data type of the column. Use one of the built-in data types.

distinct-type-name

Is the distinct type (user-defined data type) of the column. An implicit or explicit schema name qualifies the name.