||Oracle Database Tips by Donald Burleson
Examining APEX's Automatic Row Fetch
It is important to understand what the Automatic
Row Fetch is doing. This, and the next topic, can be difficult
concepts to understand so I will attempt to break them down into
manageable pieces. There are several regions on the edit process page
for an Automatic Row Fetch (ARF) process, but the most important
region is the Source region as seen in Figure 8.4.
The ARF dynamically performs SQL SELECT statements
to populate the session state for page items. The ARF is set to a
process point of On Load - After Header.
Figure 8.4 can be used to illustrate several
Table Owner: Select the schema name for the owner of
Table Name: Enter the table name or view. An ARF can
only dynamically build SQL Select statements for a single table or
Item Containing Primary Key Column Value: This is the
page item for the first primary key column. This item is used to
build the WHERE clause of the dynamic SQL statement. It is common to
set this page item in the URL while navigating to the page. The ARF
then uses the value in session state for the WHERE clause and
populates the rest of the page items.
Primary Key Column: This is also used in the
building of the WHERE clause. Looking at Figure 8.4, the ARF would
build a WHERE clause something like:
WHERE ID = :P12_ID.
Item Containing Second Key Column Value: This is the
page item for the second primary key column. It is also used in the
building of the dynamic WHERE clause and mention above.
Second Key Column: The column name for the second
database column making up the primary key for the table. The ARF can
only be used for tables that have two or fewer columns making up the
primary key. If the tables have more than two columns for the primary
key, it will be necessary to write custom PL/SQL processes. The
realization that ARF only allows for two column primary keys may
influence database design.
DML Fetch Mode: There are two modes from which to
choose, and how the session state behaves during page rendering
depends on this setting. The recommended setting for this is Set
Memory Cache on Fetch.
Set Memory Cache on Fetch: With this setting, the
session state for the page items will be set immediately after the
dynamic SQL Select is executed. If there are other page rendering
processes that use the values for page items being populated by this
ARF, this is the mode that must be used.
Set Memory Cache On Display: Using this setting will
not set session state until the page is rendered. If the developer
needs to hide the session state of page items being populated with
this process until the page is completely rendered, this is the
setting to use.
The explanation of the Valid Request information
is in the Examining Automatic Row Processing (DML) section below.
The above book excerpt is from:
Oracle Application Express
Dynamic Web Pages with OAE
Michael Cunningham & Kent Crotty