Elements of Stored Procedures - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

The set of statements constituting the main tasks of the stored procedure is called the stored procedure body, which can consist of a single statement or a compound statement, or block.

A single statement stored procedure body can contain one control statement, such as LOOP or WHILE, or one SQL DDL, DML, or DCL statement, including dynamic SQL. The following statements are not allowed:
  • Any declaration (local variable, cursor, condition, or condition handler) statement
  • A cursor statement (OPEN, FETCH, or CLOSE)
A compound statement stored procedure body consists of a BEGIN-END statement enclosing a set of declarations and statements, including:
  • Local variable declarations
  • Cursor declarations
  • Condition declarations
  • Condition handler declaration statements
  • Control statements
  • SQL DML, DDL, and DCL statements supported by stored procedures, including dynamic SQL
  • Multiple-statement requests (including dynamic multiple-statement requests) delimited by the keywords BEGIN REQUEST and END REQUEST

Compound statements can also be nested.