51.131 SET_SESSION_LIFETIME_SECONDS Procedure

This procedure sets the current session's Maximum Session Length in Seconds value, overriding the corresponding application attribute. This enables developers to dynamically shorten or lengthen the session life based on criteria determined after the user authenticates.

Syntax

APEX_UTIL.SET_SESSION_LIFETIME_SECONDS (
    p_seconds   IN NUMBER,
    p_scope     IN VARCHAR2 DEFAULT 'session' );

Parameters

Table 51-98 SET_SESSION_LIFETIME_SECONDS Parameters

Parameter Description
p_seconds A positive integer indicating the number of seconds that the session used by the application can exist.
p_scope This parameter is obsolete. The procedure always sets the lifetime for the whole session.

Example 1

The following example sets the current application's Maximum Session Length in Seconds attribute to 7200 seconds (two hours).

By setting the p_scope input parameter to use the default value of SESSION, the following example would actually apply to all applications using the current session. This would be the most common use case when multiple APEX applications use a common authentication scheme and are designed to operate as a suite in a common session.

BEGIN
   APEX_UTIL.SET_SESSION_LIFETIME_SECONDS(p_seconds => 7200);
END;

Example 2

The following example sets the current application's Maximum Session Length in Seconds attribute to 3600 seconds (one hour).

BEGIN
    APEX_UTIL.SET_SESSION_LIFETIME_SECONDS(p_seconds => 3600); 
END;