declare l_report apex_ir.t_report; l_region_id apex_application_page_ir.region_id%type; begin /* * レポートの静的IDからリージョンIDを取得する。 */ 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 = 'TASKS'; /* * バインド変数の数を確認する。 * ただし、APEX 22.2では、APEX_IR.GET_REPORTは非推奨のAPIとなっている。 * 代わりにAPEX_REGION.OPEN_QUERY_CONTEXTを使用する、とのこと。 */ l_report := apex_ir.get_report( p_page_id => :APP_PAGE_ID, p_region_id => l_region_id ); /* * バインド変数がなければ検索条件が設定されていない。 */ if l_report.binds.count = 0 then /* デフォルトのフィルタを適用する。 */ apex_ir.add_filter( p_page_id => :APP_PAGE_ID, p_region_id => l_region_id, p_report_column => 'EMAIL', p_filter_value => lower(:APP_USER), p_operator_abbr => 'EQ', p_report_alias => null ); end if; end;