Example: Creating a Procedure with Parameters and Local Variables - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

The following example creates a valid SQL procedure named sp_sample1 with the following parameters and local variables:

Variable Type Variable Name
IN ip
OUT op
local variable var1

The parameter type for ip is not specified, and defaults to IN. This procedure does not contain any condition handlers.

    CREATE PROCEDURE sp_sample1(   ip INTEGER, 
                               OUT op INTEGER) 
    BEGIN DECLARE var1 INTEGER;
      SELECT col1 INTO var1 
         FROM tab1 
         WHERE col2 = ip;
      SET op = var1 * 10;
    END;