17.00 - Example: SHOW MACRO - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Release Date
September 2020
Content Type
Programming Reference
Publication ID
B035-1144-170K
Language
English (United States)

The following request displays the most recently executed definition of the new_emp macro.

     SHOW MACRO new_emp;

The database system reports the following macro definition.

     REPLACE MACRO new_emp(   
       name   CHARACTER(20) NOT NULL, 
       street CHARACTER(30), 
       city   CHARACTER(20), 
       number INTEGER, 
       dept   SMALLINT DEFAULT 999)
     AS (INSERT INTO employee (name, street, city,
                   emp_no, dept_no)
           VALUES (:name, :street, :city, :number, :dept); 
          UPDATE department 
           SET emp_count = emp_count + 1 
          WHERE  dept_no = :dept;);