Databases Reference
In-Depth Information
Listing 12-3. Full APEX f?p syntax
f?p=<application>:<page>:<session ID>:<request>:<clear cache>:<item names>:<item values>
The relative URL f?p=100:2:2244749031848871:::2:P2 ID:12345 , is a request to render page 2 of
application 100, for the session 2244749031848871. It directs any existing session state on page 2 to be
removed and sets the value of the item P2 ID to be 12345. Be aware that application developers normally
never have to write code or even create these links; they are generated by declarative page controls, such
as a page branch.
Page posts and URLs that set session state are two examples of setting session state. Session state
can also be set in PL/SQL using bind variable assignments. Listing 12-4 shows the PL/SQL source of an
example APEX page process that queries an Oracle table then sets an item using the PL/SQL assignment
syntax.
Listing 12-4. Example PL/SQL Page Process That Sets Session State
BEGIN
FOR C1 IN (SELECT NAME
FROM PROJECTS
WHERE ID = :P2 ID) LOOP
:P2 NAME := C1.NAME;
END LOOP;
END;
When APEX executes PL/SQL that assigns values to bind variables, it ensures that the session state is
maintained. The code in Listing 12-4 will allow the bind variable :P2 NAME to be referenced in
subsequent SQL statements, or using the &P2 NAME. syntax to reference session state in non-SQL
contexts.
Page computations can set application item or page item values using a variety of methods.
Computations provide a convenient and well-structured method for setting session state and are very
useful for setting static values. Figure 12-6 shows a step in the wizard used to create computations.
Figure 12-6. Defining a page computation
Search WWH ::




Custom Search