16.10 - Transaction Processing in Teradata Session Mode - Teradata Database

Teradata Database SQL Fundamentals

Product
Teradata Database
Release Number
16.10
Published
June 2017
Content Type
Programming Reference
Publication ID
B035-1141-161K
Language
English (United States)
Last Update
2018-04-25

A Teradata SQL transaction can be a single Teradata SQL statement, or a sequence of Teradata SQL statements, treated as a single unit of work.

Each request is processed as one of the following transaction types:
  • Implicit
  • Explicit
  • Two-phase commit (2PC)

Implicit Transactions

An implicit transaction is a request that does not include the BEGIN TRANSACTION and END TRANSACTION statements. The implicit transaction starts and completes all within the SQL request: it is self-contained.

An implicit transaction can be a:

  • Single DML statement that affects one or more rows of one or more tables.
  • Macro or trigger containing one or more statements.
  • Request containing multiple statements separated by SEMICOLON characters. SEMICOLON characters can appear anywhere in the input line. The Parser interprets a SEMICOLON at the end of an input line as the request terminator.

DDL statements are not valid in a multistatement request and are therefore not valid in an implicit multistatement transaction.

Explicit Transactions

In Teradata session mode, an explicit transaction contains one or more statements enclosed by BEGIN TRANSACTION and END TRANSACTION statements. The first BEGIN TRANSACTION initiates a transaction and the last END TRANSACTION terminates the transaction.

When multiple statements are included in an explicit transaction, you can only specify a DDL statement if it is the last statement in the series.

2PC Rules

2PCprotocol is supported in Teradata session mode:
  • A 2PC transaction contains one or more DML statements that affect multiple databases and are coordinated externally using the 2PC protocol.
  • A DDL statement is not valid in a two-phase commit transaction.