16.20 - Example: Creating SQL Procedures With a Single Statement - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Content Type
Programming Reference
Publication ID
B035-1144-162K
Language
English (United States)
Last Update
2019-05-24

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;