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

Teradata Database SQL Data Definition Language Syntax and Examples

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1144-151K

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;