APEX_APPLICATION

The APEX_APPLICATION package is a PL/SQL package that implements the Oracle Application Express rendering engine. This package is useful to take advantage of many global variables. Table describes the global variables available in the APEX_APPLICATION package.

Global Variables

Global Variable Description
G_USER Specifies the currently logged in user.
G_FLOW_ID Specifies the ID of the currently running application.
G_FLOW_STEP_ID Specifies the ID of the currently running page.
G_FLOW_OWNER Specifies the schema to parse for the currently running application.
G_REQUEST Specifies the value of the request variable most recently passed to or set within the show or accept modules.
G_BROWSER_LANGUAGE Refers to the web browser’s current language preference.
G_DEBUG Refers to whether debugging is currently switched on or off. Valid values for the DEBUG flag are ‘Yes’ or ‘No’. Turning debug on shows details about application processing.
G_HOME_LINK Refers to the home page of an application. The Application Express engine redirects to this location if no page is given and if no alternative page is dictated by the authentication scheme’s logic.
G_LOGIN_URL Used to display a link to a login page for users that are not currently logged in.
G_IMAGE_PREFIX Refers to the virtual path the web server uses to point to the images directory distributed with Oracle Application Express.
G_FLOW_SCHEMA_OWNER Refers to the owner of the Application Express schema.
G_PRINTER_FRIENDLY Refers to whether the Application Express engine is running in print view mode. This setting can be referenced in conditions to eliminate elements not desired in a printed document from a page.
G_PROXY_SERVER Refers to the application attribute ‘Proxy Server’.
G_SYSDATE Refers to the current date on the database server. this uses the DATE DATATYPE.
G_PUBLIC_USER Refers to the Oracle schema used to connect to the database through the database access descriptor (DAD).
G_GLOBAL_NOTIFICATION Specifies the application’s global notification attribute.
G_X01, … G_X10 Specifies the values of the X01, … X10 variables most recently passed to or set within the show or accept modules. You typically use these variables in On Demand AJAX processes.

See Also: APP_AJAX_X01, … APP_AJAX_X10 in Oracle Application Express Application Builder User’s Guide

Select
APEX_ITEM.TEXT(P_IDX        =>     1,
               p_value      =>    'Test Value' ,
               p_size       =>    32,
               p_maxlength  =>    32) from dual;

Output

<input type="text" name="f01" size="32" maxlength="32" value="Test Value" />

HELP Procedure

Syntax

APEX_APPLICATION.HELP (
    p_request        IN VARCHAR2 DEFAULT NULL,
    p_flow_id        IN VARCHAR2 DEFAULT NULL,
    p_flow_step_id   IN VARCHAR2 DEFAULT NULL,
    p_show_item_help IN VARCHAR2 DEFAULT 'YES',
    p_show_regions   IN VARCHAR2 DEFAULT 'YES',
    p_before_page_html     IN VARCHAR2 DEFAULT '<p>',
    p_after_page_html      IN VARCHAR2 DEFAULT NULL,
    p_before_region_html   IN VARCHAR2 DEFAULT NULL,
    p_after_region_html    IN VARCHAR2 DEFAULT '</td></tr></table></p>',
    p_before_prompt_html   IN VARCHAR2 DEFAULT '<p><b>',
    p_after_prompt_html    IN VARCHAR2 DEFAULT '</b></p>:&nbsp;',
    p_before_item_html     IN VARCHAR2 DEFAULT NULL,
    p_after_item_html      IN VARCHAR2 DEFAULT NULL);
BEGIN
   APEX_APPLICATION.HELP (p_request              => NULL,
                          p_flow_id              => :app_id,
                          p_flow_step_id         => :app_page_id,
                          p_show_item_help       => 'YES',
                          p_show_regions         => 'YES',
                          p_before_page_html     => '<p>',
                          p_after_page_html      => NULL,
                          p_before_region_html   => NULL,
                          p_after_region_html    => '</td></tr></table></p>',
                          p_before_prompt_html   => '<p><b>',
                          p_after_prompt_html    => '</b></p>:&nbsp;',
                          p_before_item_html     => NULL,
                          p_after_item_html      => NULL);
END;

Example ????

Implementation

  • Create a page to show application help.
  • Create a region of type ‘PL/SQL Dynamic Content’ and add the APEX_APPLICATION.HELP call as PL/SQL Source.
  • Write help text on the page Help Text attribute
  • Run the Page.
Parameter Description
p_request Not used.
p_flow_id The application ID that contains the page or item level help you want to output.
p_flow_step_id The page ID that contains the page or item level help you want to display.
p_show_item_help Flag to determine if item level help is output. If this parameter is supplied, the value must be either ‘YES’ or ‘NO’, if not the default value is ‘YES’.
p_show_regions Flag to determine if region headers are output (for regions containing page items). If this parameter is supplied, the value must be either ‘YES’ or ‘NO’, if not the default value is ‘YES’.
p_before_page_html Use this parameter to include HTML between the page level help text and item level help text.
p_after_page_html Use this parameter to include HTML at the bottom of the output, after all other help.
p_before_region_html Use this parameter to include HTML before every region section. Note this parameter is ignored if p_show_regions is set to ‘NO’.
p_after_region_html Use this parameter to include HTML after every region section. Note this parameter is ignored if p_show_regions is set to ‘NO’.
p_before_prompt_html Use this parameter to include HTML before every item label for item level help. Note this parameter is ignored if p_show_item_help is set to ‘NO’.
p_after_prompt_html Use this parameter to include HTML after every item label for item level help. Note this parameter is ignored if p_show_item_help is set to ‘NO’.
p_before_item_html Use this parameter to include HTML before every item help text for item level help. Note this parameter is ignored if p_show_item_help is set to ‘NO’.
p_after_item_html Use this parameter to include HTML after every item help text for item level help. Note this parameter is ignored if p_show_item_help is set to ‘NO’.

STOP_APEX_ENGINE Procedure

This procedure signals the Application Express engine to stop further processing and immediately exit to avoid adding additional HTML code to the HTTP buffer.

Syntax

APEX_APPLICATION.STOP_APEX_ENGINE

Parameters: None

Example 1

This example tells the browser to redirect to http://apex.oracle.com/ and immediately stops further processing.

owa_util.redirect_url('http://apex.oracle.com');
apex_application.stop_apex_engine;

Example 2

This example also tells the browser to redirect to http://apex.oracle.com/ and immediately stops further processing. But, this time the code also contains a WHEN OTHERS exception handler which deals with the apex_application.e_stop_apex_engine used by apex_application.stop_apex_engine.

begin
    ... code which can raise an exception ...
    owa_util.redirect_url('http://apex.oracle.com');
    apex_application.stop_apex_engine;
exception
    when apex_application.e_stop_apex_engine then
        raise; -- raise again the stop Application Express engine exception
    when others then
        ...; -- code to handle the exception
end;