DECLARE TABLE | Teradata Vantage - DECLARE TABLE - Advanced SQL Engine - Teradata Database

SQL Stored Procedures and Embedded SQL

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
xqq1557098602407.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1148
lifecycle
previous
Product Category
Teradata Vantage™

Purpose

Declares tables used by the embedded SQL statements within an application.

Invocation

Nonexecutable preprocessor declaration.

Embedded SQL only.

Syntax

DECLARE { table_name | view_name } TABLE ( column_spec [,...] )
column_spec
column_name data_type [ null_attribute ]
table_name
The name of the table to be declared.
If the same name is used in a CREATE TABLE statement in your program, the description of the table in the CREATE TABLE statement and the DECLARE TABLE statement must be identical.
view_name
The name of the view to be declared.
If the same name is used in a CREATE TABLE statement in your program, the description of the table in the CREATE TABLE statement and the DECLARE TABLE statement must be identical.
column_name
The name of a column or columns being declared for the table.
data_type
The data type for column_name.
null_attribute
The nullability specification for column_name.
If the null_attribute is NOT NULL, nulls are not permitted and there is no default value specified.
If the null_attribute is NOT NULL WITH DEFAULT, nulls are not permitted and a default values is specified.
If the null_attribute is not specified, null are permitted.

ANSI Compliance

DECLARE TABLE is a Teradata extension to the ANSI/ISO SQL:2011 standard.

Authorization

None.

Usage

DECLARE TABLE is useful for program documentation, but Preprocessor2 treats it only as a comment.

Preprocessor2 does not verify the syntax or correctness of the field definitions other than identifying, in order:
  1. The DECLARE keyword
  2. The presence of a table_name or view_name
  3. The TABLE keyword