16.5 Understanding Application Processes
Create an application process to run a block of PL/SQL logic at a specific point from multiple pages of an application. By default, application processes execute at the same point for every page in the application. However, you can apply conditions for specific pages to control when the process executes.
Tip:
To learn more about execution behavior in the case of a validation error, see "What Happens When a Validation Fails?."
- On Demand Application Processes
- About Application Processes that Execute On New Instance
- About Running an On Demand Process from a Page Request
- Application Process Example
- Creating an Application Process
- Editing Application Process Attributes
- Creating Application Process Error Messages
- Viewing the Application Processes History Report
See Also:
Parent topic: Managing Computations, Validations, and Processes
16.5.1 On Demand Application Processes
An On Demand process is special type of application process which has a Process Point of On Demand, is of type PL/SQL, and executes when called from a page-level On Demand process or from an Ajax call from the browser. On Demand processes are useful when you have PL/SQL logic that you would like to run from different execution points across multiple pages.
On Demand processes should typically be created on a page and not at the application-level. On Demand processes created at the application-level are created with an initial authorization scheme of Must Not Be Public User. This prohibits the processes being invoked from users in unauthenticated sessions.
See Also:
Parent topic: Understanding Application Processes
16.5.2 About Application Processes that Execute On New Instance
Typically an application process runs at the same point across multiple pages in an application. Processes having a Process Point of On New Instance are the exception. These types of processes are useful when you only need to retrieve information once within a user's session. For example, if the application items do not depend on the logged in user, you can initialize them using the Process Point On New Instance. To look up information that depends on the user, you can also use After Authentication.
If you configure applications to share the same session by setting the same cookie name in the authentication scheme, On New Instance and After Login, the application processes fire whenever Oracle Application Express first processes a request for the application (that is, On New Instance), or processes a request of an authenticated user for the application (that is, After Authentication).
Parent topic: Understanding Application Processes
16.5.3 About Running an On Demand Process from a Page Request
You can have a page request run an On Demand process by using the following syntax:
f?p=application_id:page_id:session:APPLICATION_PROCESS=process_id
Where:
-
application_id
is the application ID or alphanumeric alias -
page_id
is the page number or alphanumeric alias -
session
is the session ID -
APPLICATION_PROCESS=process_id
is the keywordAPPLICATION_PROCESS=
followed by either the process ID or an alphanumeric name of an application-level process having a Process Point of On Demand
When you use this syntax, the Application Express engine recognizes the request and processes it using the following rules:
-
The page number in the URL can be the current page number or alias. A page number or alias is required in the request only as a syntactic placeholder because no specific page is accessed for this type of request.
-
The process authorization scheme, the application's authorization scheme, and the process conditions are supported.
-
Session state (that is, item names and values) may be set in the URL, but clear cache options are ignored.
-
Any failures of authentication, authorization, or process conditions do not result in visible error messages or other indicators of such failures and most often result in a blank page being displayed. Note that if you are logged in to App Builder as a developer, an error messages displays.
-
Specifying the process by name locates the first process with the specified (case-preserved) name.
See Also:
Parent topic: Understanding Application Processes
16.5.4 Application Process Example
A shopping cart application is a good example of when you might use an application process. For example, to display the contents of a user's shopping cart with each page view, you create a region on page zero of your application that displays the values of the application-level items TOTAL_CART_ITEMS
and TOTAL_PURCHASE_PRICE
.
Instead of writing a process for each page to set the values of TOTAL_CART_ITEMS
and TOTAL_PURCHASE_PRICE
, you could write an application process of type On Load: Before Header to compute these values. Then, the Application Express engine would execute the process on each page as it renders the application. As a result, each page, would display the most current values for TOTAL_CART_ITEMS
and TOTAL_PURCHASE_PRICE
.
Parent topic: Understanding Application Processes
16.5.5 Creating an Application Process
To create an application process:
See Also:
Parent topic: Understanding Application Processes
16.5.6 Editing Application Process Attributes
To edit an existing page process:
Parent topic: Understanding Application Processes
16.5.7 Creating Application Process Error Messages
If a process raises an error, you can define an error messages that displays to the user. How the error message displays depends upon the processing point. For processes with a processing point of On Submit - Before Computation and Validations
or On Submit - After Computations and Validations
, you can specify whether the error message displays inline on the current page (the default) or on a separate page. For all other application processes, error messages display on a separate error page.
To create an application process error message:
- Access the application process attributes.
- Edit the following attributes:
- Click Apply Changes.
See Also:
Parent topic: Understanding Application Processes
16.5.8 Viewing the Application Processes History Report
The Application Process History report displays recent modifications made to application processes.
To access application processes History reports:
See Also:
Parent topic: Understanding Application Processes