Tera Macro

  • Teradata Tutorial
  • Teradata Basics

A macro is a Teradata extension to ANSI SQL that contains pre written SQL statements. Macros are used to run a repeatable set of tasks.The details of macro can be found in data dictionary (DD). Macros are database objects and thus they belong to a specified user or database. A macro can be executed by Queryman., BTEQ, by another macro. Tera 3 is a modular software synthesizer program based on many different synthesizer technologies including “spectrum synthesis”. Users will benefit from this new versions improvements which include a “free running” envelope mode and a stereo mode to its Distortion Effect feature. Publisher: VirSyn Software Synthesizer. Macro is a set of SQL statements which are stored and executed by calling the Macro name. The definition of Macros is stored in Data Dictionary. Users only need EXEC privilege to execute the Macro. Users don't need separate privileges on the database objects used inside the Macro. Macro statements are executed as a single transaction.

  • Teradata Advanced
  • Teradata Useful Resources
  • Selected Reading

Macro is a set of SQL statements which are stored and executed by calling the Macro name. The definition of Macros is stored in Data Dictionary. Users only need EXEC privilege to execute the Macro. Users don't need separate privileges on the database objects used inside the Macro. Macro statements are executed as a single transaction. If one of the SQL statements in Macro fails, then all the statements are rolled back. Macros can accept parameters. Macros can contain DDL statements, but that should be the last statement in Macro.

Create Macros

Macros are created using CREATE MACRO statement.

Syntax

Following is the generic syntax of CREATE MACRO command.

Example

Consider the following Employee table.

EmployeeNoFirstNameLastNameBirthDate
101MikeJames1/5/1980
104AlexStuart11/6/1984
102RobertWilliams3/5/1983
105RobertJames12/1/1984
103PeterPaul4/1/1983

The following example creates a Macro called Get_Emp. It contains a select statement to retrieve records from employee table.

Executing Macros

Macros are executed using EXEC command.

Syntax

Following is the syntax of EXECUTE MACRO command.

Example

The following example executes the Macro names Get_Emp; When the following command is executed, it retrieves all records from employee table.

Parameterized Macros

Teradata Macros can accept parameters. Within a Macro, these parameters are referenced with ; (semicolon).

Following is an example of a Macro that accepts parameters.

Executing Parameterized Macros

Macros are executed using EXEC command. You need EXEC privilege to execute the Macros.

Syntax

Following is the syntax of EXECUTE MACRO statement.

Example

Tera Term Macro

The following example executes the Macro names Get_Emp; It accepts employee no as parameter and extracts records from employee table for that employee.

I’m using Tera Term for login and work on a server. And, I feel it is annoying to login manually.

Tera Term has the macro functionality. So, it can login to server by only Double Click by some settings.

In this article, I introduce how to auto login by Tera Term macro.

【Step1】Associate with macro file(.ttl file)

The macro file extension is “.ttl”. So, to set file association to execute Tera Term macro(ttpmacro.exe) by double click .ttl file.

The following the article is useful, please see.
https://www.lifewire.com/how-to-change-file-associations-in-windows-2624477

【Step2】Create macro file(.ttl file)
Macro

This is a sample .ttl file.

Change the following setting depending on your environment.

  • username:User name to login
  • password:User password
  • hostname:Server host name or IP address
  • logfilename:Log file name (entered command and output is written)
  • /auth:How to authenticate
  • logdir:Output folder of log fil

Tera Term Macro Examples

Create .ttl file, then double click to check login to server!!

Tera Term Macro File

…((((*ФωФ)ノ Go Go ♪

Comments are closed.