38.2 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 38-2 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

Note:

The CREATE_SESSION procedure is not supported in the SQL Commands and SQL Scripts tools within SQL Workshop.

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;