17.05 - Example: Creating SQL Procedures With a Single Statement - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Advanced SQL Engine
Teradata Database
Release Number
Release Date
January 2021
Content Type
Programming Reference
Publication ID
English (United States)

The following are examples of procedures with a single statement that is not enclosed in a BEGIN … END compound statement:

  • A procedure with a single SET statement:
        CREATE PROCEDURE sp_sample4a (IN  in_param  INTEGER,
                                      OUT out_param INTEGER) 
             SET out_param = in_param + 1;
  • A procedure with a WHILE statement:
        CREATE PROCEDURE sp_sample4b (IN  in_param  INTEGER,
                                      OUT out_param INTEGER)
        WHILE (in_param < 20)
            SET out_param = in_param + 1;
        END WHILE;