ORA-20987: APEX - Interactive report region does not exist in application
I'm trying to get the query of an IR (Interactive Report) on a specific page in my application.
The code I'm using is thesi:
create or replace function get_report_query(nPage_id IN number)
return varchar2
as
l_report apex_ir.t_report;
l_query varchar2(32767);
l_list varchar2(32767);
nRegion_id number;
nIR_id number;
nm owa.vc_arr;
vl owa.vc_arr;
BEGIN
SELECT region_id
INTO nRegion_id
FROM apex_application_page_regions
WHERE application_name = 'E-BRIL'
AND page_id = nPage_id
AND source_type = 'Interactive Report';
nIR_id :=
apex_ir.get_last_viewed_report_id (p_page_id => nPage_id,
p_region_id => nRegion_id);
nm(1) := 'DUMMY_JUST_TO_SET_UP_OWA_UTIL';
vl(1) := 'WHATEVER';
owa.init_cgi_env( nm.count, nm, vl );
l_report := APEX_IR.GET_REPORT (
p_page_id => nPage_id,
p_region_id => nRegion_id,
p_report_id => 0);
l_query := l_report.sql_query;
for i in 1..l_report.binds.count
loop
l_list := l_list||i||'. '||l_report.binds(i).name||'='||l_report.binds(i).value;
end loop;
return l_query;
end;
/
I want to get the query of the IR on my page 3. So I execute;
get_report_query(3)
This is what I get:
ORA-20987: APEX - Interactive report region does not exist in application , page 3 and region 1278226325207011749. - Contact your application administrator.
ORA-06512: at "APEX_040200.WWV_FLOW_ERROR", line 630
ORA-06512: at "APEX_040200.WWV_FLOW_ERROR", line 911
ORA-06512: at "APEX_040200.WWV_FLOW_WORKSHEET_UTIL", line 33
ORA-06512: at "APEX_040200.WWV_FLOW_WORKSHEET_UTIL", line 55
ORA-06512: at "EBR_OWNER.GET_REPORT_QUERY", line 19
The regio_id looks ok, because when I query this region_id from apex_application_page_regions, the id 1278226325207011749 is returned.
The page 3 is also ok.
I tried to follow Denes Kubicek his blog (Denes Kubicek ApEx BLOG: Getting Interactive Report Query).
What am I doing wrong here?
We use Apex 4.2.
Thanx in advance.
reg,
Chris