create or replace context gctx using gpack accessed globally
/
create or replace package gpack as
function getnamespace return varchar2;
procedure setctx (attr varchar2, value varchar2);
procedure clearctx (attr varchar2);
end;
/
create or replace package body gpack as
function getnamespace return varchar2 is begin return 'gctx'; end;
procedure setctx (attr varchar2, value varchar2) is
begin
dbms_session.set_context (namespace=>getnamespace, attribute=>attr, value=>value);
end;
procedure clearctx (attr varchar2) is
begin
dbms_session.clear_context (namespace=>getnamespace, attribute=>attr);
end;
end;
/
并非如此,通过添加一个子句
ACCESSED GLOBALLY,上下文将在所有会话中可用。看一看(或尝试一下):
在会话 A 中:
在会话 B 中:
更多细节在ch。全局应用程序上下文文档。