Modifying Stored Procedures - Advanced SQL Engine - Teradata Database

SQL Fundamentals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
zwv1557098532464.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1141
lifecycle
previous
Product Category
Teradata Vantageâ„¢

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;