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

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
imq1591724555718.ditamap
dita:ditavalPath
imq1591724555718.ditaval
dita:id
B035-1184
lifecycle
previous
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.