December 6

0 comments

Important Facts That You Should Know About The Teradata Macro

By DWH Pro Admin

December 6, 2019

macro

What is a Teradata Macro?

The Teradata macro is functionality used to execute multiple SQL queries in one transaction. Either all requests of the macro are successful or all changes to database objects are rolled back!

What are the Features of Teradata Macros?

  • Macros encapsulate application logic and access control 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

DWH Pro Admin


Teradata and Data Warehouse Specialist with more than 20 years of experience

You might also like

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Never miss a good story!

 Subscribe to our newsletter to keep up with the latest trends!

>