16.20 - Modifying Stored Procedures - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantageâ„¢ SQL Fundamentals

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-02
dita:mapPath
zce1519094756513.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval

To modify a stored procedure definition, use the REPLACE PROCEDURE statement.

Example: Inserting Salary Information into the Employee Table

Assume you want to change the previous example to insert salary information to the Employee table for new employees.

The REPLACE PROCEDURE statement looks like this:

REPLACE PROCEDURE NewProc (IN name CHAR(12),
                           IN number INTEGER,
                           IN dept INTEGER,
                           IN salary DECIMAL(10,2),
                           OUT dname CHAR(10))
BEGIN
   INSERT INTO Employee (EmpName, EmpNo, DeptNo, Salary_Amount)
      VALUES (name, number, dept, salary);
   SELECT DeptName
      INTO dname FROM Department
         WHERE DeptNo = dept;
END;