| Gloabal Temporary Table [message #575196] |
Mon, 21 January 2013 04:08  |
 |
sgollapudi
Messages: 9 Registered: January 2013 Location: HYDERABAD
|
Junior Member |
|
|
Hi All,
Global temporary tables data is session specific. But I am able to access from pragma autonomous_transaction,
As pragma autonomous_transaction creates a new session then how can it is able to accessing the gtt data.
Thanks in advance.
sgollapudi.
Please find below code.
create global temporary table test_preserve( a number) on commit preserve rows
/
create or replace procedure sp1 as
pragma autonomous_transaction;
a number;
begin
select count(*) into a from test_preserve;
dbms_output.put_line('a '||a);
commit;
end;
/
create or replace procedure sp2 as
begin
insert into test_preserve values (100);
commit;
sp1;
end;
/
set serveroutput on
begin
sp2();
end;
/
a 1
|
|
|
|
|
|
|
|