Skip to content

Instantly share code, notes, and snippets.

@hhudson
Created June 3, 2022 15:18
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hhudson/2f9d9f196d3f9bedc97f556c91d77950 to your computer and use it in GitHub Desktop.
Save hhudson/2f9d9f196d3f9bedc97f556c91d77950 to your computer and use it in GitHub Desktop.
APEX_IR PLSQL used in APEX Instant Tip
DECLARE
l_report APEX_IR.T_REPORT;
l_region_id apex_application_page_regions.region_id%type;
l_binds varchar2(4000);
BEGIN
select region_id
into l_region_id
from apex_application_page_regions
where application_id = :APP_ID
and page_id = :APP_PAGE_ID
and static_id = 'custom_query';
l_report := APEX_IR.GET_REPORT (
p_page_id => :APP_PAGE_ID,
p_region_id => l_region_id );
:P2_UNDERLYING_SQL := l_report.sql_query ;
for i in 1..l_report.binds.count
loop
l_binds := l_binds ||CHR(13)||CHR(10)||l_report.binds(i).name||' = '||l_report.binds(i).value;
end loop;
:P2_BIND_VALUES := l_binds;
END;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment