DB2 Version 9.7 for Linux, UNIX, and Windows

Autonomous transactions are supported

Version 9.7 provides a mechanism to run and commit a block of statements independent of the outcome of the invoking transaction. This mechanism, referred to as an autonomous transaction, implies that work is committed even if the invoking transaction itself is rolled back.

This feature is particularly useful when you migrate applications using autonomous features supported by other database systems to Version 9.7. You can migrate those applications more easily.

To enable an autonomous transaction, specify the new keyword AUTONOMOUS when using the CREATE PROCEDURE statement. A procedure that you define with this new keyword runs within its own session, meaning that the procedure is independent of the calling procedure. If an autonomous procedure is successfully completed, the work is committed; if the procedure fails, the work is rolled back. In either case, the calling transaction is not affected.

You can use the autonomous_transaction.db2 sample program to learn how to use this feature.