15.00 - 15.10 - Elements of an SQL Stored Procedure - Teradata Database

Teradata Database Introduction to Teradata

Product
Teradata Database
Release Number
15.00
15.10
Content Type
User Guide
Publication ID
B035-1091-151K
Language
English (United States)
Last Update
2018-09-25

An SQL stored procedure contains some or all of the following elements.

 

This element…

Includes…

SQL control statements

nested or non-nested compound statements.

Control declarations

  • Condition handlers in DECLARE HANDLER statements for completion and exception conditions. Conditional handlers can be:
  • CONTINUE or EXIT type.
  • Defined for a specific SQLSTATE code, the generic exception condition SQLEXCEPTION, or generic completion conditions NOT FOUND and SQLWARNING.
  • Cursor declarations in DECLARE CURSOR statements or in FOR iteration statements.
  • Cursors can be either updatable or read only type.

    Cursors can also be result set cursors for returning the result of a SELECT statement executed in the stored procedure to the caller or client applications

  • Local variable declarations in DECLARE statements.
  • SQL transaction statements

    DDL, DCL, DML, and SELECT statements, including dynamic SQL statements, with a few exceptions.

    LOCKING modifiers

    with all supported SQL statements except CALL.

    Comments

    bracketed and simple comments.

    Note: Nested bracketed comments are not allowed.

    For more information, see “SQL Stored Procedures as SQL Applications” on page 98.