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

Basic Teradata® Query Reference

prodname
Basic Teradata Query
vrm_release
17.00
created_date
June 2020
category
Programming Reference
featnum
B035-2414-220K

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.