Using Macros in ITEQ - Interactive Teradata Query Facility

Interactive Teradata Query Reference

Product
Interactive Teradata Query Facility
Release Number
15.00
Language
English (United States)
Last Update
2018-09-28
dita:id
B035-2451
lifecycle
previous
Product Category
Teradata Tools and Utilities

Using Macros in ITEQ

A macro can contain one or more Teradata SQL statements and certain ITEQ commands, listed below. A user may:

  • Define a macro by entering a Teradata SQL CREATE MACRO statement.
  • Execute the macro by entering a Teradata SQL EXECUTE MACRO statement.
  • Display an existing CREATE or REPLACE version of a previously defined macro in the display area, use edit control commands to modify the macro, and then replace the existing version by executing the SUBMIT command.
  • Only the following ITEQ commands can be executed from a macro:

  • REMARK
  • SET DEFAULTS
  • SET FORMAT
  • SET NULL
  • SET PAGELENGTH
  • SET PF
  • SET RTITLE
  • SET SUPPRESS
  • SET WIDTH
  • ITEQ commands in macros must be embedded in Teradata SQL ECHO statements. For example:

    ECHO ’SET WIDTH 72;’;

    When the Teradata DBS encounters an ECHO statement during execution, it sends a response parcel containing the character string to the client system. ITEQ then interprets the character string as an ITEQ command. If the character string is not one of the commands acceptable to ITEQ, ITEQ ignores it.

    If a macro is executed in Format mode, only the formatted results of SELECT statements contained in the macro are displayed at the user’s terminal. Processing, status, and statistics of individual statements are not displayed.

    If a macro is executed in Unformat mode, ITEQ displays the following:

  • ITEQ commands executed
  • Type of processing performed
  • Status and statistics generated
  • Unformatted SELECT statement results
  • For a detailed description of how macros are created, defined, and executed, see Database Administration and SQL Data Definition Language.