16.10 - ViewTable - Teradata Database

Teradata Database SQL Request and Transaction Processing

prodname
Teradata Database
vrm_release
16.10
created_date
June 2017
category
Programming Reference
User Guide
featnum
B035-1142-161K

Function of ViewTable

Captures the DDL for any views used in a query.

ViewTable Table Definition

The following CREATE TABLE request defines ViewTable:

   CREATE SET TABLE ViewTable(
     QueryID   INTEGER NOT NULL,
     ViewName  VARCHAR128 CHARACTER SET UNICODE
               UPPERCASE NOT CASESPECIFIC NOT NULL,
     DBName    VARCHAR128 CHARACTER SET UNICODE
               UPPERCASE NOT CASESPECIFIC NOT NULL,
     ViewText  VARCHAR(30000) CHARACTER SET UNICODE
               NOT CASESPECIFIC,
     SeqNumber BYTEINT NOT NULL,
     Complete  CHAR(1)CHARACTER SET LATIN NOT CASESPECIFIC)
   PRIMARY INDEX QueryID_ViewName_DBName (QueryID,ViewName,DBName);

Attribute Definitions for ViewTable

The following table defines the ViewTable attributes:

Attribute Definition
QueryID
  • Unique identifier for the query.
  • Partial NUPI for the table.
ViewName
  • Name of the view.
  • Partial NUPI for the table.
DBName
  • Name of the database.
  • Partial NUPI for the table.
ViewText Stores the DDL view text.
  • If ViewText <= 30,000 characters, SeqNumber is set to 1.
  • If ViewText > 30,000 characters, SeqNumber is set to 1 + (1-n), where n is the identifier for the fragment of ViewText stored in the row following the first fragment

When ViewText > 30,000 characters, only the first 30,000 are stored and the remaining text is stored in overflow rows within ViewTable. The overflow rows are identified by their SeqNumber value.

SeqNumber The sequence of ViewText stored in this row.
Complete Identifies whether ViewTable stores the complete view DDL or a truncated version.
  • If F, ViewText DDL is truncated.

    This case occurs when the size specified in the LIMIT SQL clause of the DUMP EXPLAIN or INSERT EXPLAIN statement that captured the view is less than the actual length of ViewText.

    See SQL Data Manipulation Language.

  • If T, Full ViewText DDL is stored.

    Overflow ViewText DDL is stored in additional rows in ViewTable. Individual overflow rows are identified by their respective SeqNumber.