Sequence Controls - Basic Teradata Query

Basic Teradata Query Reference

Basic Teradata Query
Release Number
October 2018
English (United States)
Last Update
Product Category
Teradata Tools and Utilities

The following commands control the sequence of execution for all instructions supplied from BTEQ commands, SQL requests and external commands' execution. In particular, the commands cover enabling branching on errors within scripts as well as designating retry strategies to be employed for DBS failure responses.

BTEQ Command Function
= ( EQUAL ) Repeats the previous Teradata SQL request a specified number of times.
ERRORLEVEL This control enables users to specify how database errors map to severity levels.
ERRORONDBSWARNING This control enables users to specify that database warnings are to be treated as though they are errors. This allows the ERRORLEVEL status value to also be assigned to the severity level associated with each encountered warning.
EXIT or QUIT Logs off all database sessions and then exits BTEQ.
EXITONDELAY This control enables users to specify the maximum time duration within which to allow a submitted SQL request to be processed before CLI will time out the request. When a timeout occurs, the BTEQ process will terminate. The timeout is triggered when either the database goes down or the duration is exceeded.
GOTO Skips over all intervening BTEQ commands and SQL statements until a specified label is encountered, then resumes processing as usual.
HANG Causes BTEQ to pause for a specified period of time.
IF Used to conditionally execute portions of the input script. The IF clause can contain one or more conditions to enable testing multiple status values. These individual checks can be ANDed or ORed together, as well as be negated via NOT operations. When the collective test result is found to be TRUE, the THEN clause action gets taken.
LABEL Identifies the point at which BTEQ resumes processing, as specified in a previous GOTO command.
MAXERROR This control enables users to specify a maximum error severity level beyond which BTEQ terminates job processing.
OS Submits an operating system command to a workstation-attached system.
REPEAT This control enables users to specify the maximum number of times the next SQL request is to be submitted.
REPEATSTOP This control enables users to specify whether a REPEAT operation should terminate if an error occurs for a request that indicates the request cannot be re-tried.
TSO Submits a command to the z/OS interactive TSO environment.