Using Scripts, Run Files, Macros, and Stored Procedures - Basic Teradata Query

Basic Teradata Query Reference

Product
Basic Teradata Query
Release Number
16.10
Published
May 2017
Language
English (United States)
Last Update
2018-06-28
dita:mapPath
wmy1488824663431.ditamap
dita:ditavalPath
Audience_PDF_include.ditaval
dita:id
B035-2414
lifecycle
previous
Product Category
Teradata Tools and Utilities

Depending on where they are stored and how they are executed, files that contain a user’s BTEQ commands and Teradata SQL statements are called scripts, run files, macros, or stored procedures:

File Type Description Usage
Script, or input stream file A disk file contained within the SYSIN file on a Mainframe-attached system. A set of commands and requests that produces a standard report or display, and that has been thoroughly tested.
Run file A disk file that is not contained within the SYSIN file. A set of commands and requests that can be used repeatedly. For example, to produce the same report or display on a daily or weekly basis.
Stored procedure A file that is created, compiled and stored on the Teradata Database (either externally or internally), and is executed in response to a Teradata SQL CALL statement. A number of users who need to perform the same operations on a regular basis.
Macro A file that is created and stored on a Teradata Database, and is executed in response to a Teradata SQL EXECUTE statement. A number of users who need to produce the same report or display on a regular basis.

Use a text editor to create and maintain BTEQ scripts, stored procedure source text, and run files. Use the Teradata SQL CREATE MACRO and ECHO statements to create BTEQ macros.

The ECHO statement is not compatible with the COMPILE command.

Use the COMPILE command in BTEQ to create internally stored procedures (also known as SQL stored procedures) in the Teradata Database.