This procedure creates a new session for the given application, set environment and run the application's Initialization PL/SQL Code.
Syntax
procedure create_session ( p_app_id in number, p_page_id in number, p_username in varchar2 );
Parameters
Table 30-1 CREATE_SESSION Procedure Parameters
| Parameters | Description |
|---|---|
|
|
The application id. |
|
|
The application page. |
|
|
The session user. |
Raises
WWV_FLOW.APP_NOT_FOUND_ERR: The application does not exist or the caller has no access to the workspace.
Example
This example creates a session for EXAMPLE USER in application 100 page 1, then print the app id and session id.
begin
apex_session.create_session (
p_app_id => 100,
p_page_id => 1,
p_username => 'EXAMPLE USER' );
sys.dbms_output.put_line (
'App is '||v('APP_ID)||', session is '||v('APP_SESSION'));
end;
See Also:
Parent topic: APEX_SESSION
This procedure deletes the session with the given ID. If the session is currently attached, call the application's Cleanup PL/SQL Code and reset the environment. This procedure does nothing if the given session does not exist or if the caller can not access the session's workspace.
Syntax
procedure delete_session (
p_session_id in number default wwv_flow.g_instance );
Parameters
Table 30-2 DELETE SESSION Procedure Parameters
| Parameters | Description |
|---|---|
|
|
The session id. |
Raises
APEX.SESSION.EXPIRED: The session does not exist.
SECURITY_GROUP_ID_INVALID: Current workspace does not match session workspace.
Example
Delete session 12345678.
begin
apex_session.delete_session (
p_session_id => 12345678 );
end;
See Also:
Parent topic: APEX_SESSION
This procedure based on the given application and session current, sets environment and runs the Initialization PL/SQL Code.
Syntax
procedure attach (
p_app_id in number,
p_page_id in number,
p_session_id in number );
Parameters
Table 30-3 Attach Procedure Parameters
| Parameters | Description |
|---|---|
|
|
The application id. |
|
|
The application page. |
|
|
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: The session does not exist.
SECURITY_GROUP_ID_INVALID: Current workspace does not match session workspace.
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;
See Also:
Parent topic: APEX_SESSION
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.
Syntax
procedure detach;
Example
Detach from the current session..
begin
apex_session.detach;
end;
See Also:
Parent topic: APEX_SESSION