RETCANCEL Command | Basic Teradata Query - 17.00 - RETCANCEL - 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

Purpose

This control enables users to specify whether to cancel a request when the number of rows specified by the RETLIMIT command is exceeded.

Syntax


RETCANCEL syntax

where the following is true:

OFF
BTEQ stops displaying data when the specified limit is exceeded but continues gathering data from the database.

OFF is the initial default value.

It may be the best choice when executing multi-statement requests because it allows each statement to execute and process records up to the set limit.

ON
BTEQ cancels the remainder of the SQL request when the specified limit is reached.

When neither ON or OFF is specified, BTEQ sets RETCANCEL to ON.

Usage Notes

If a RETLIMIT value for rows has not been specified, the RETCANCEL command does not affect BTEQ.

The RETCANCEL command is valid in an SQL macro.

Example 1 – RETCANCEL

The following example shows the RETCANCEL command used in conjunction with the RETLIMIT command:

.set retcancel   
.set retlimit 10
select id, firstname from mytable order by 1;
   
*** Query completed. 1498 rows found. 2 columns returned.
*** Total elapsed time was 1 second.
   
          Id  FirstName
------------  --------------------
           1  Betty
           2  Michael
           3  Rory
           4  Pat
           5  Stanley
           6  Ed
           7  Jane
           8  Edward
           9  Emily
          10  Tom
*** Warning: RetLimit exceeded.
             Cancelling the request.

Example 2 – RETCANCEL Instigated By a Macro

The RETCANCEL command in an SQL macro appears as follows:

ECHO '.SET RETCANCEL ON';