Chapter 42. DBMS_TRANSACTION

Table of Contents

42.1. Overview
42.2. Procedures
42.2.1. COMMIT
42.2.2. ROLLBACK, ROLLBACK_SAVEPOINT
42.2.3. SAVEPOINT

This chapter briefly introduces the DBMS_TRANSACTION package, and describes how to use the procedures of the package.

42.1. Overview

The DBMS_TRANSACTION package executes SQL statements that manage transactions in the tbPSM program.

Note

For further information on the SQL statements, refer to Tibero SQL Reference Guide.

42.2. Procedures

This section describes the procedures provided by the DBMS_TRANSACTION package, in alphabetical order.

42.2.1. COMMIT

Commits the current transaction.

Details about the COMMIT procedure are as follows:

  • Prototype

    DBMS_TRANSACTION.COMMIT;
  • Example

    BEGIN
        DBMS_TRANSACTION.COMMIT;
    END;

42.2.2. ROLLBACK, ROLLBACK_SAVEPOINT

Rolls back the current transaction completely or to a specified savepoint.

Details about the ROLLBACK and ROLLBACK_SAVEPOINT procedures are as follows:

  • Prototype

    • Complete transaction rollback

      DBMS_TRANSACTION.ROLLBACK;
    • Rollback to savepoint

      DBMS_TRANSACTION.ROLLBACK_SAVEPOINT
      (
          savepoint       IN VARCHAR
      );
  • Parameter

    ParameterDescription
    savepointSavepoint name.
  • Example

    BEGIN
        INSERT INTO EMP VALUES (1, 'chulsoo');
        DBMS_TRANSACTION.ROLLBACK;
    END;

42.2.3. SAVEPOINT

Specifies a new savepoint for the current transaction.

Details about the savepoint procedure are as follows:

  • Prototype

    DBMS_TRANSACTION.SAVEPOINT
    (
        savepoint     IN VARCHAR
    );
  • Parameter

    ParameterDescription
    savepointSavepoint name.
  • Example

    BEGIN
        DBMS_TRANSACTION.SAVEPOINT('sp1');
        INSERT INTO EMP VALUES (2, 'younghee');
        DBMS_TRANSACTION.ROLLBACK_SAVEPOINT('sp1');
    END;