Producing Conditional Messages - 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

One common use of BTEQ testing and branching is to produce a message if certain conditions are met. For example, a script might include a request that is expected to change the database. In this case, an activity count of zero indicates a problem, even if no error code is returned. If the request is critical to the operations, try including the following command in the script, right after the request:

.IF ACTIVITYCOUNT = 0 THEN .QUIT 65

In this case, the return code of 65 would have been predefined to indicate that the request did not change the database.

Or, before quitting BTEQ, try branching to a different part of the script and use the REMARK command to specify a descriptive message to elaborate on the return code, as follows:

.IF ACTIVITYCOUNT = 0 THEN .GOTO PROB65
   .
   .
   .
.LOGOFF
.EXIT 0
.LABEL PROB65
.REMARK 'Prob 65: The . . . request did not affect any rows'
.QUIT 65