Getting different session id when using pragma autonomous_transaction
816802Aug 15 2011 — edited Aug 16 2011Hi All,
I got a question regarding Pragma Autonomous_Transaction.
When a Pragma Autonomous_Transaction is called, the code using it will be executed totally in a different session.
In that case when I am trying to print the session ids, then I am still getting the same.
Please find the below example.
declare
y varchar2(250);
procedure pr_1 is
pragma autonomous_transaction;
x varchar2(250);
begin
select sys_context('USERENV','SID') into x from dual;
dbms_output.put_line(x);
end pr_1;
begin
pr_1;
select sys_context('USERENV','SID') into y from dual;
dbms_output.put_line(y);
end;
/
OUTPUT
708
708
Request to correct my understanding on Pragma Autonomous_Transaction.
Thanks,
Madhu K.