Subject: Accessing Pipelined table function over db link is not working in Apex
Dear All,
Sorry for posting on old thread but this is most relevant post for my query.
On remote DB, below activities done:
1.
CREATE OR REPLACE CONTEXT apex_sc_ctx USING schema_a.pkg_4_context_mgmt ACCESSED GLOBALLY;
2. Created schema_a.pkg_4_context_mgmt
This package has below stored programs:
Procedure: set_context_values : Takes parameters as input and set up application context like ..
DBMS_SESSION.SET_CONTEXT('apex_sc_ctx', 'lc_machine', p_machine);
Function: GET_DATA_FNCGet parameters and returns SQL_REFCURSOR.
Function: GET_DATA_PIPE_FNC
which utilizes object type like TYPE DATA_TAB_TY IS TABLE OF sometable%ROWTYPE; Takes input SQL_REFCURSOR from GET_DATA_FNC & form pipelined output.
3. Created view over above pipelined function:
CREATE OR REPLACE VIEW V_DATA
AS
SELECT *
FROM TABLE(schema_a.pkg_4_context_mgmt .GET_DATA_PIPE_FNC (pkg_4_context_mgmt .GET_DATA_FNC(sys_context('apex_scheduler_ctx','lc_machine') ) ) );
At local database, I have a public db link connecting to schema_a of remote database.
1. I fire schema_a.pkg_4_context_mgmt .set_context_values @db_lnk(:P7_MACHINE); to set the application context. There are many parameters, hence separate application context was created.
2. When I run above view [V_DATA] in sql developer. It takes in to account the parameter passed and provide filtered output. Eg. SELECT * FROM V_DATA@db_lnk;
But when I run the same sql statement in SQL Workshop => SQL Command, it doesn't take in to account the application context set up on remote db and entire dataset is returned.
I also created a classic report based on above view, still the outcome remains same.
Versions:
Remote DB: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
Local DB : Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production Version 18.4.0.0.0
Oracle Apex Build: 20.1.0.00.13
Can you please suggest if I am missing anything?