Register Login

Use and purpose of Autonomous Transaction

Updated May 18, 2018

What is use of autonomous transaction and kindly tell me the purpose of autonomous transaction with one real time scenario?


Comments

  • 06 Aug 2015 2:31 pm Abhijeet Mudgal Best Answer

    Autonomous transactions are used where we want to commit the subprogram irrespective if the main program gets commited/rollback.

    One of the scenario is to generate a audit report. Many times we see any webpage, we are required to register and then most of us provide junk values. Suppose you have a application which accepts user registration but not all users provide accurate data. So in case if a user provides accurate data, he gets registered and if he does provide junk data/duplicate data he get error and then he might not get interested to register.

    So In this scenario not every user gets registered but many of them take a attempt. If we want to know that how ma y users tried to attempt the registration process and how many actually got registered. We can use autonomous pragma in TRIGGER. When any user enters the details, trigger will write and commit the data in some table. Suppose that user got some eror then main transaction will get rollback but this table will have the data. So end of the day you can check the counts that how many tried to attempt and how many got successfully registered.


×