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

What is a Teradata Macro?

The Teradata macro executes multiple SQL queries in a single transaction, ensuring that all requests are successful or changes to database objects are rolled back.

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.

Related Services

🔧 Need Expert Database Administration?

Our team brings 25+ years of enterprise DBA experience across Teradata, Snowflake, and Oracle.

Meet Our Team →

📋 Considering a Move From Teradata?

Get a personalized migration roadmap in 2 minutes. We have migrated billions of rows from Teradata to Snowflake, Databricks, and more.

Free Migration Assessment →

📊 Data Platform Migration Survey

Help us map where the industry is heading. Results are public — see what others chose.

1. What is your current data platform?

2. Where are you migrating to (or evaluating)?

Migrating FROM
Migrating TO

Thanks for voting! Share this with your network.

Follow me on LinkedIn for daily insights on data warehousing and platform migrations.

Stay Ahead in Data Warehousing

Get expert insights on Teradata, Snowflake, BigQuery, Databricks, Microsoft Fabric, and modern data architecture — delivered to your inbox.

Leave a Comment

DWHPro

Expert network for enterprise data platforms. Senior consultants, project teams built for your challenge — across Teradata, Snowflake, Databricks, and more.

📍Vienna, Austria & Jacksonville, Florida

Quick Links
Services Team Teradata Book Blog Contact Us
Connect
LinkedIn → [email protected]
Newsletter

Join 4,000+ data professionals.
Weekly insights on Teradata, Snowflake & data architecture.