HANA SQL- Autonomous Transaction

light111Autonomous Transaction


The processing part inside autonomous transaction is independent from the main procedure.  Regardless of the main transaction commit or rollback, autonomous transaction changes are not affected. A default’ COMMIT’ is triggered at the end of autonomous transaction.

Let’s start- Below we have table entry and we are trying to update the URL for a CARRID in autonomous transaction section though the main procedure has a ROLLBACK.

1

In the below AMDP procedure, an autonomous transaction section is declared and we have an DB UDPATE happens in the auto transaction section.

3

Here in the report we just call the AMDP method and finally we have a ROLLBACK.

2

Execute the report and the debug details-

4

Now the rollback is executing.

5

Now though the ROLLBACK happens finally, but as the UDPATE happens in the autonomous transaction section where an implicit COMMIT is triggered and the update is persisted.

6

It could be possible that we can explicitly maintain COMMIT or ROLLBACK in the auto transaction but at the end implicit COMMIT is triggered.

7


 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s