Home > APEX_UTIL > SET_SESSION_L...
Previous |
Next |
This procedure sets the current application's Maximum Session Length in Seconds value for the current session, overriding the corresponding application attribute. This allows developers to dynamically shorten or lengthen the session life based on criteria determined after the user authenticates.
Note: In order for this procedure to have any effect, the application's Maximum Session Length in Seconds attribute must have been set to a non-zero value in the application definition. This procedure will have no effect if that attribute was not set by the developer. |
Syntax
APEX_UTIL.SET_SESSION_LIFETIME_SECONDS ( p_seconds IN NUMEBER, p_scope IN VARCHAR2 DEFAULT 'SESSION');
Parameters
Table: SET_SESSION_STATE Parameters describes the parameters available in the SET_SESSION_LIFETIME_SECONDS
procedure.
SET_SESSION_LIFETIME_SECONDS Parameters
Parameter | Description |
---|---|
|
A positive integer indicating the number of seconds the session used by this application is allowed to exist. |
|
Defaults to 'SESSION' and may also be set to 'APPLICATION'. If 'SESSION', all applications using this session are affected. If 'APPLICATION', only the current application using the current session is affected. |
Example 1
The following example shows how to use the SET_SESSION_LIFETIME_SECONDS procedure to set the current application's Maximum Session Length in Seconds attribute to 7200 seconds (two hours). This API call will have no effect if the application's Maximum Session Length in Seconds attribute was not set by the developer to a non-zero value in the application definition.By allowing 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 Application Express 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 shows how to use the SET_SESSION_LIFETIME_SECONDS procedure to set the current application's Maximum Session Length in Seconds attribute to 3600 seconds (one hour). This API call will have no effect if the application's Maximum Session Length in Seconds attribute was not set by the developer to a non-zero value in the application definition.By overriding the p_scope input parameter's default value and setting it to 'APPLICATION', the following example would actually apply to only to the current application using the current session even if other applications are using the same session.
BEGIN APEX_UTIL.SET_SESSION_LIFETIME_SECONDS(p_seconds => 3600, p_scope => 'APPLICATION'); END;