Debugging a function or procedure which references APEX items using the V/NV functions or trying to debug APEX collections can be frustrating when the only way to set, and view, the values is to actually do it through the application. Thankfully, there’s a way to create an APEX session from a PL/SQL session to test out your code.
They’re various examples on the APEX forums on how to create an APEX session in PL/SQL. Here’s one version of it.
1 | create or replace procedure sp_create_apex_session( |
To create an APEX session (in PL/SQL) to mimic some tests I can do the following:
1 | begin |
View some APEX session state variables:
1 | select |
You can also create and view collections using the APEX_COLLECTION
APIs and the APEX_COLLECTION
view.