APEX_SESSION
ATTACH Procedure
In my previous blog , I have shared the way to query APEX_COLLECTIONS data from database backend itself. That approach needs to follow three steps.
- Setting up Workspace
- Setup Application ID
- Setup Session id
Today let’s explore the APEX_SESSION API. And specifically ATTACH procedure. Which is helpful to achieve the same.
Purpose:
This procedure based on the given application and session current, sets environment and runs the Initialization PL/SQL Code.
BEGIN
apex_session.attach (p_app_id => 177, -- Application ID
p_page_id => 5, -- Page ID
p_session_id => 19278163964528 -- Session ID
);
END;
After executing the ATTACH procedure we can query the APEX collections from back end and also we can Access the Page ITEM Values
QUERY the APEX_COLLECTIONS
SELECT * FROM apex_collections
where collection_name= 'TEST';
Access APEX page Items
SELECT v('P5_ITEM') FROM dual;
DETACH Procedure
This procedure detaches from the current session, resets the environment and runs the application’s Cleanup PL/SQL Code. This procedure does nothing if no session is attached.
begin
apex_session.detach;
end;
Other Useful Links