Databases Reference
In-Depth Information
Session state can be set for application items and page items. Application items are not displayed on
any page and are simply used to maintain state. Page items have the dual role of maintaining state and
displaying values. A page item's definition can be assigned using a number of methods. In Figure 12-7
the value for item P2 PROJECT is set from a database column value.
Figure 12-7. Editing page item source
You can also set the session state from a source value “always from source” or “only when the value
of the item is null”. The actual source can come from a static text assignment, SQL query, SQL
Expression, or PL/SQL code snippets. This provides fine-grained control and flexibility in managing your
session state using just a few declarative attributes.
Referencing session state is accomplished using different methods, with the access method
depending on the context. To access session state from SQL or PL/SQL you use bind variable syntax,
with a colon before the name of the variable. The SQL query in Listing 12-5 demonstrates how a report
region query can use a bind variable syntax.
Listing 12-5. Example SQL Query Referencing Session State Using Bind Variables
select name, owner
from projects
where project id = :P2 PROJECT ID
The same syntax also works in PL/SQL.
Application pages can define page processes of type PL/SQL. Listing 12-6 is an example of a PL/SQL
process referencing session state.
Search WWH ::




Custom Search