31.3 CREATE_SESSION Procedure

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,
   p_call_post_authentication in boolean default false );

Parameters

Table 31-3 CREATE_SESSION Procedure Parameters

Parameters Description

p_app_id

The application id.

p_page_id

The application page.

p_username

The session user.

p_call_post_authentication

If true, call post-authentication procedure. The default is false.

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;