Monday, 5 June 2017

Autonomous Transactions in Oracle PLSQL

Autonomous Transactions:-Autonomous transaction is a independent Transaction that is called by another transaction.
                         Autonomous Transactions is a way by which we can call function or procedure as a complete transaction without affecting main transaction (Calling Environment).

Note:-When an autonomous transaction is called, the main transaction (calling transaction) is being temporarily suspended. The autonomous transaction must commit or roll back before it returns
      to calling transaction.

Declaration :- PRAGMA AUTONOMOUS_TRANSACTION;

Example:-
Declare
PRAGMA AUTONOMOUS_TRANSACTION;
begin
update emp set sal=sal+2000 where deptno=10;
commit;
end;
/
update emp set sal=sal+5000 where deptno=20;

rollback;

Note:-When rollback executed here then only last update statement will rollbacked so here executed procedure is working as a autonomous transaction.





1 comment:

  1. Thanks for the given information you are providing content very usefull to users.
    Learn How to Work With Ref Cursor in ORACLE 12C For Beginner Actual cost of this course is 9,999/- But now Kuncham Software Solutions Pvt ltd is giving you Free access. Limited period offer Hurry-up Enroll Now at Udemy.


    Hurry-Up Enroll Now and get Free Access to the Entire Course


    ReplyDelete

Cloning database with RMAN

Below are the steps to clone production database(primedb) to UAT database(clonedb)   STEP1 :- Check the both servers are able to connect ...