ECHOREQ - Basic Teradata Query - 16.20

Basic Teradata Query Reference

prodname
Basic Teradata Query
vrm_release
16.20
category
Programming Reference
featnum
B035-2414-108K

Purpose

This control enables users to specify if a copy of the Teradata SQL requests and BTEQ commands should be placed in the standard output stream.

Syntax



Usage Notes

Use the ECHOREQ command before a series of BTEQ commands or requests to enable or inhibit the return (echo) of a copy of each command or request. (BTEQ does not echo the password portion of the LOGON command.)

Action Result
ECHOREQ command has not been specified. The initial default value is ON and BTEQ echoes all SQL requests and BTEQ commands.
ECHOREQ command is used and ON, ERRORONLY or OFF is not specified. BTEQ assumes ON.
ECHOREQ ERRORONLY is specified. BTEQ does not echo any SQL, but echoes all BTEQ commands. That is, for BTEQ commands it equates to ECHOREQ ON. In case the SQL results in a DBS Failure or Error, the request text is printed to the standard error stream as part of the Failure or Error message.
The behavior for BTEQ commands to be treated as ON for ERRORONLY case may change in a later release, where failed BTEQ commands will behave same way as failed SQL requests, in which case, the BTEQ command will not be echoed, but will be printed if it fails.
ECHOREQ OFF is specified. BTEQ does not echo any SQL or BTEQ command.
The ECHOREQ command is not related to the Teradata SQL ECHO statement.

The ECHOREQ command cannot be used in a Teradata SQL macro.

When ERRORONLY is in effect and the SQL request was issued with a REPEAT factor greater than 1, it may be the case that there is more than one error response and that the first error may not be for the first response sequence. For the duration of the REPEAT, only one instance of request text echoing will be done.

Example – ECHOREQ

To inhibit echoing input, enter the following command:

.SET ECHOREQ OFF

To inhibit echoing of SQL requests, but still getting them printed when they return DBS Error or Failure, type:

.SET ECHOREQ ERRORONLY

as in:

Interactive Mode

BTEQ -- Enter your SQL request or BTEQ command:
.SET ECHOREQ ERRORONLY
.SET ECHOREQ ERRORONLY
BTEQ -- Enter your SQL request or BTEQ command:
.SHOW CONTROLS ECHOREQ
.SHOW CONTROLS ECHOREQ
[SET] ECHOREQ = ERRORONLY
BTEQ -- Enter your SQL request or BTEQ command:
SELECT date;
*** Query completed. One row found. One column returned.
*** Total elapsed time was 1 second.
    Date
--------
12/02/21
BTEQ -- Enter your SQL request or BTEQ command:
SELECT junk;
*** Failure 3822 Cannot resolve column 'junk'. Specify table or view.
                 Statement# 1, Info =0
*** Request Text:
SELECT junk;
*** Total elapsed time was 1 second.
BTEQ -- Enter your SQL request or BTEQ command:

Batch Mode

+---------+---------+---------+---------+---------+---------+---------+
   .SET ECHOREQ ERRORONLY
+---------+---------+---------+---------+---------+---------+---------+
   .SHOW CONTROLS ECHOREQ
   [SET] ECHOREQ = ERRORONLY
+---------+---------+---------+---------+---------+---------+---------+
   *** Query completed. One row found. One column returned.
   *** Total elapsed time was 1 second.
       Date
   --------
   12/02/21
+---------+---------+---------+---------+---------+---------+---------+
   *** Failure 3822 Cannot resolve column 'junk'. Specify table or view.
                    Statement# 1, Info =0
   *** Request Text:
   SELECT junk;
   *** Total elapsed time was 1 second.
+---------+---------+---------+---------+---------+---------+---------+