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

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
wgr1555383704548.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

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;