My Oracle Support Banner

SYS_CONTEXT with namespace returns empty after execution of DBMS_SCHEDULER (Doc ID 2850904.1)

Last updated on FEBRUARY 23, 2022

Applies to:

Oracle Database - Enterprise Edition - Version 19.12.0.0.0 and later
Information in this document applies to any platform.

Symptoms

When we use dbms_scheduler with sys_context with namespace, the value return is empty after the execution of the dbms_scheduler.
The following code on the PDB with the USER test:

set serveroutput on size unlimited
declare
-- Local variables here
gv_job_name VARCHAR2(30);
v_action varchar2(1000) :='BEGIN
NULL; END;';
vv_lan varchar2(10);
begin
gv_job_name := 'J' ||
TRIM(TO_CHAR(userenv('sessionid')
,'0999999990'));
--Initialisation de la variable de context
pck_ctx_uti_osc.pn_set_lng_drp(pv_co_lan => 'FRA');
-- Lecture de la variable de context
vv_lan := sys_context(namespace => 'XXXXXX' ,attribute => 'LANGUE');
dbms_output.put_line(' AVANT DBMS : '||vv_lan);
-- Test statements here
dbms_scheduler.create_job(job_name => gv_job_name
,job_type => 'PLSQL_BLOCK'
,job_action => v_action
,enabled => true
,auto_drop => TRUE);
dbms_scheduler.run_job(job_name => gv_job_name);
vv_lan := sys_context(namespace => 'XXXXXX' ,attribute => 'LANGUE');
dbms_output.put_line(' APRES DBMS : '||vv_lan);
end;
/

The result is the following
AVANT DBMS : FRA
APRES DBMS :        >>>>>>>>>>Empty

It works fine with use_current_session=>FALSE but it's not possible for many of the customer applications.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.