Usage Considerations for DDL Statements in Procedures - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

Advanced SQL Engine
Teradata Database
Release Number
July 2021
English (United States)
Last Update
Product Category
Teradata Vantage™
  • You can use DDL COMMENT statements in a procedure. You cannot specify DML COMMENT statements, which are restricted to embedded SQL applications, to fetch the comments for database objects, columns of a table, and parameters.
  • The queue table form of CREATE TABLE (see CREATE TABLE (Queue Table Form)) cannot be executed in a procedure. All other forms of the CREATE TABLE statement are valid.
  • If a CREATE VOLATILE TABLE statement is included in a procedure, the volatile table is created in the database of the user. If an object with the same name already exists in that database, the result is a runtime exception.

    DML statements within a procedure referencing the volatile table must either have the login database of the user as the qualifier, or not have any qualifying database name.

  • A CREATE DATABASE or CREATE USER statement in a procedure must contain the FROM clause. The statement result depends on the FROM clause as indicated by the following table.
    WHEN a procedure … THEN …
    contains a FROM clause the specified database is the immediate owner of the user or database created.
    does not contain a FROM clause the system reports an SPL compilation error during procedure creation.

    If you specify either a CREATE USER statement or a CREATE DATABASE statement without a FROM clause as a dynamic SQL statement within a procedure, the same error is reported as a runtime exception during procedure execution.