Wednesday, April 24, 2013

pragma autonomous_transaction

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;

No comments:

Post a Comment

Command to do active duplicate for Oracle Database

1. First login to target server 2. Validate tns connectivity between Source DB and Target DB 3. Prepare and validate space availability 4. S...