DWHPro Insights

Unlocking the Power of Teradata Macros: Features, Creation, and Execution

By Roland Wenzlofsky ·

Unlocking the Power of Teradata Macros: Features, Creation, and Execution

What is a Teradata Macro?

A macro executes its statements as a request, with transaction behavior governed by session mode and any enclosing transaction. Do not infer an unconditional commit. Quoting the Subscriber identifier allowed CREATE/REPLACE, EXECUTE and DROP to complete in the fixture.

What are the Features of Teradata Macros?

  • Macros encapsulate application logic and control access to it
  • The code of macros is stored in DBC tables
  • Because macros are stored in DBC tables, they are available for all client tools.
  • Macros can be called with parameters and are, therefore, flexible.
  • Macros can be used, for example, to ensure referential integrity.
  • Macros are optimized before execution.
  • Macros can execute other macros.

How is a Macro created?

CREATE MACRO ShowSubscribers AS
(
  SELECT Lastname, Firstname FROM "Subscriber";
);

How is a Macro changed?

REPLACE MACRO ShowSubscribers AS
(
  SELECT Lastname, Firstname, BirthDate FROM "Subscriber";
);

How is a Macro dropped?

DROP MACRO ShowSubscribers;

How is a Macro executed?

EXECUTE ShowSubscribers;

More details can be found in the official Teradata documentation.

Teradata Query Performance Tuning: The DWHPro Guide book cover

Get the complete Teradata tuning book, free

Teradata Query Performance Tuning: The DWHPro Guide
By Roland Wenzlofsky & Artemios Vogiatzis

206 pages on statistics and demographics, access paths and indexes, query execution plans, and joins. Get the full PDF and practical Teradata updates from DWHPro.

Confirm your email to receive your download link. Privacy policy. Unsubscribe in any newsletter.

About the free book

Building or improving a data pipeline?

Discuss ingestion, transformations, orchestration, quality checks and operational handover.

Explore data engineering services

Teradata Query Performance Tuning: The DWHPro Guide book cover

Get the complete Teradata tuning book, free

Teradata Query Performance Tuning: The DWHPro Guide
By Roland Wenzlofsky & Artemios Vogiatzis

206 pages on statistics and demographics, access paths and indexes, query execution plans, and joins. Get the full PDF and practical Teradata updates from DWHPro.

Confirm your email to receive your download link. Privacy policy. Unsubscribe in any newsletter.

About the free book

Follow DWHPro in Google to see our articles more often in Search.

Leave a Comment

Teradata Query Performance Tuning: The DWHPro Guide book cover

Get the complete Teradata tuning book, free

Teradata Query Performance Tuning: The DWHPro Guide
By Roland Wenzlofsky & Artemios Vogiatzis

206 pages on statistics and demographics, access paths and indexes, query execution plans, and joins. Get the full PDF and practical Teradata updates from DWHPro.

Confirm your email to receive your download link. Privacy policy. Unsubscribe in any newsletter.

About the free book

Protected by Security by CleanTalk and CleanTalk Anti-Spam