Table of ContentsPreviousNext

Database Migration


BEGIN TRANSACTION Conversion from Microsoft SQL Server to Oracle

Microsoft SQL Server allows starting explicit or nested transactions using BEGIN TRANSACTION. COMMIT statements for such transaction decrease @@TRANCOUNT by 1 without making updates permanent. If a name is specified, Microsoft SQL Server application can rollback the transaction to its beginning or to a defined BEGIN TRANSACTION statement.

Explicit transactions are not supported in Oracle but Oracle can rollback a part of work. For this purpose use a SAVEPOINT statement. The SAVEPOINT statement allows identify a point in a transaction to which you can roll back later. After the SAVEPOINT statement has been created, you can continue processing, commit your work, rollback the entire transaction, or rollback to the SAVEPOINT.

Therefore, SQLWays emulates the Microsoft SQL Server BEGIN TRANSACTION statement for ROLLBACK using Oracle SAVEPOINT statement.

SQLWays changes BEGIN TRANSACTION statement with name to SAVEPOINT statement. BEGIN TRANSACTION statements without name are dropped.

Examples:

TABLE 37. BEGIN TRANSACTION Conversion from Microsoft SQL Server to Oracle
Microsoft SQL Server
Oracle
Description

BEGIN

BEGIN

 

BEGIN TRAN

 

 

BEGIN TRANSACTION

 

 

BEGIN TRANSACTION tran1

SAVEPOINT tran1

 

BEGIN TRANSACTION @val_tran1

SAVEPOINT tran1

If @val_tran1 equal 'tran1'

BEGIN TRANSACTION @val_tran1

WITH MARK 'transaction 1

SAVEPOINT tran1

If @val_tran1 equal 'tran1'


Ispirer Systems
http://www.ispirer.com
ispirer@ispirer.com
Table of ContentsPreviousNext