STORED PROCEDURE in Teradata

Stored procedures are called Persistent Stored Modules with a set of control and condition handling statements that make SQL a computationally complete programming language.
They promote a server-based procedural interface to the Teradata application developers.

Syntax:
CREATE PROCEDURE procedureName (IN/OUT/INOUT fields with datatypes)
    BEGIN
        SQL statements;
    END;


Why stored procedure ?
1. They can do data validations.
2. They can possess consolidate and centralize logic.
3. Complex process that requires execution of several SQL statements is moved into stored procedures.
4. Stored procedures accept parameters, and are the preferred method of both manipulating data and simply returning data.
5. Batch query execution that may do all DML operations depending on each other
(Ex: Inserting a value in a table and returning a another value depending on the inserted value.)

CREATING, RENAMING, ALTERING Procedures are discussed separately in ForgetCode.


..