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

Basic Teradata® Query Reference

Product
Basic Teradata Query
Release Number
17.00
Published
December 2020
Language
English (United States)
Last Update
2020-12-12
dita:mapPath
zqt1544831938740.ditamap
dita:ditavalPath
obe1474387269547.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 SQL requests 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 within a database (either externally or internally), and is executed in response to an SQL CALL statement. A number of users who need to perform the same operations on a regular basis.
Macro A set of SQL requests stored within a database that can be executed in response to an 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 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) within a database.