SQL Used to Modify a Macro - Teradata Database

Database Introduction

Product
Teradata Database
Release Number
15.00
Language
English (United States)
Last Update
2018-09-25
dita:id
B035-1091
lifecycle
previous
Product Category
Teradata® Database

The following example shows how to modify a macro. Suppose you want to change the NewEmp macro so that the default department number is 300 instead of 100. The REPLACE MACRO statement looks like this:

    REPLACE MACRO NewEmp (name VARCHAR(12),
                          number INTEGER NOT NULL,
                          dept INTEGER DEFAULT 300)
    AS (INSERT INTO Employee (Name,
                              EmpNo,
                              DeptNo)
        VALUES (name,
                number,
                dept)
        ;
        UPDATE Department
        SET EmpCount=EmpCount+1
        WHERE DeptNo=dept
        ;
       )
    ;