Two Types of ROLLBACK Requests - Teradata Database - Teradata Vantage NewSQL Engine

SQL Data Manipulation Language

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-03
dita:mapPath
fbo1512081269404.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata Vantage™

There are two categories of ROLLBACK requests, those that can be evaluated by the parser and do not require access to a table and those that require table access.

If ROLLBACK expressions are processed that do not reference tables, and if their order of execution is not important relative to the other requests in a multistatement request or macro, then they should be placed ahead of any requests that reference tables so that the rollback operation can be done at minimum cost.

In the following example, the first two ROLLBACK requests can be evaluated by the parser and do not require access to tables. The third ROLLBACK request requires access to a table.

     CREATE MACRO macro_name (
       p1 INTEGER,
       p2 INTEGER)
     AS. . .
     ROLLBACK 'error' WHERE :p1 < 0;
     ROLLBACK 'error' WHERE :p2 < 0;
     SELECT. . .
     ROLLBACK 'error' WHERE tab.c1 = :p1;