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

Teradata Vantage™ - SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1146-175K
Language
English (United States)

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;