17.10 - Macro Support for Global Temporary and Volatile Tables - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1184-171K
Language
English (United States)

You can reference both global temporary tables and volatile tables from a macro.

When you perform a macro that involves a global temporary table, then all references to the base temporary table are mapped to the corresponding materialized global temporary table within the current session. Note that this means the same macro, when performed from two different sessions, can have very different results depending on the content of the materialized global temporary tables.

When you perform a macro that contains an INSERT request that inserts rows into a global temporary table, and that table is not materialized in the current session, then an instance of the global temporary table is created when the INSERT request performs.

When you perform a macro that contains a CREATE VOLATILE TABLE request, then the referenced table is created in the current session. If the macro includes a DROP on the named volatile table, then that table is dropped from the current session.