17.10 - Example: Creating SQL Procedures with Single Statement - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1144-171K
Language
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;