41.1 ATTACH Procedure

This procedure sets the environment and runs the Initialization PL/SQL Code based on the given application and current session.

Syntax

APEX_SESSION.ATTACH (
    p_app_id        IN  NUMBER,
    p_page_id       IN  NUMBER,
    p_session_id    IN  NUMBER );

Parameters

Table 41-1 ATTACH Parameters

Parameters Description
p_app_id The application ID.
p_page_id The application page.
p_session_id The session ID.

Raises

  • WWV_FLOW.APP_NOT_FOUND_ERR: Application does not exist or caller has no access to the workspace.
  • APEX.SESSION.EXPIRED: Your session has ended.
  • SECURITY_GROUP_ID_INVALID: Security Group ID (your workspace identity) is invalid.

Example

Attach to session 12345678 for application 100 page 1, then print the app ID and session ID.

begin
    apex_session.attach (
        p_app_id     => 100,
        p_page_id    => 1,
        p_session_id => 12345678 );
    sys.dbms_output.put_line (
        'App is '||v('APP_ID')||', session is '||v('APP_SESSION'));
end;