Autonomous transaction clause will initiate an independent transaction , not new session as per below test case.
DECLARE
PROCEDURE A
AS
pragma autonomous_transaction;
BEGIN
dbms_output.put_line ( 'Inside Autonomous transaction My session id ' || sys_context ( 'USERENV' , 'SID' ) ) ;
ROLLBACK;
END ;
BEGIN
dbms_output.put_line ( 'My session id ' || sys_context ( 'USERENV' , 'SID' ) ) ;
a;
dbms_output.put_line ( 'Outside Autonomous transaction My session id ' || sys_context ( 'USERENV' , 'SID' ) ) ;
END;
DECLARE
PROCEDURE A
AS
pragma autonomous_transaction;
BEGIN
dbms_output.put_line ( 'Inside Autonomous transaction My session id ' || sys_context ( 'USERENV' , 'SID' ) ) ;
ROLLBACK;
END ;
BEGIN
dbms_output.put_line ( 'My session id ' || sys_context ( 'USERENV' , 'SID' ) ) ;
a;
dbms_output.put_line ( 'Outside Autonomous transaction My session id ' || sys_context ( 'USERENV' , 'SID' ) ) ;
END;
No comments:
Post a Comment