Oracle: How do I set a context variable?
The above works just fine.

SQL&gt; create or replace context t1_ctx using t1_pkg accessed globally;

Context created.

SQL&gt;

create or replace package t1_pkg
as
    procedure setx;
end t1_pkg;
/

Package created.

SQL&gt;

create or replace package body t1_pkg
as
    procedure setx is
    begin
        dbms_session.set_context('t1_ctx','x','1');
    end;
end t1_pkg;
/

Package body created.

SQL&gt; select sys_context('t1_ctx', 'x') from dual;

SYS_CONTEXT('T1_CTX','X')
--------------------------------------------------------------------------------


SQL&gt; exec t1_pkg.setx;

PL/SQL procedure successfully completed.

SQL&gt; select sys_context('t1_ctx', 'x') from dual;

SYS_CONTEXT('T1_CTX','X')
--------------------------------------------------------------------------------
1