Two Types of ROLLBACK Requests - Advanced SQL Engine - Teradata Database

SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
vjt1596846980081.ditamap
dita:ditavalPath
vjt1596846980081.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;