Databases Reference
In-Depth Information
The values of all APEX items, both page items and application items, are tied to this unique session identifier.
This identifier is referred to as the APP_SESSION_ID . You can see the session identifier in the URL of most pages in an
APEX application. It's highlighted in Figure 6-42 .
Figure 6-42. APEX session identifier in an APEX URL
Setting and Retrieving Session State
Session state is set by user-input items, computations, processes, and PL/SQL code. In PL/SQL, when within an APEX
process, you can set an item equal to a value, like so:
:P1_ITEM_NAME := 'some value';
In PL/SQL, when in a stored procedure, you can use the apex_util.set_session_state procedure to set a value
in session state:
apex_util.set_session_state( 'P1_ITEM_NAME', 'some value');
The syntax to retrieve session state for an item varies according to where you're referencing the item.
In templates or regions, tabs, menus, or lists, use the following substitution-string syntax (and don't forget the
trailing dot!):
&P1_ITEM_NAME.
Use the following syntax in SQL statements:
:P1_ITEM_NAME
From PL/SQL, use one of the following two options depending on what type of block or program unit you're in:
Anonymous PL/SQL block: :P1_ITEM_NAME
PL/SQL Unit Called from APEX: V('P1_ITEM_NAME')
Within conditions, use this syntax:
P1_ITEM_NAME
the V function just mentioned is an ApeX-provided function that retrieves the session-state value of an ApeX item.
exercise caution when using this function, because using it in a stored program unit could introduce performance issues.
Note
Viewing Session State
To view session state, click the Session link on the Developer toolbar. You should see a page like that in Figure 6-43 .
Then use the Page, Find, and Views parameters to view session state for the application. The drop-down View menu
shown in Figure 6-44 allows you to view Page Items, Application Items, Session State, Collections, and All of the above.
 
 
Search WWH ::




Custom Search