|Oracle® Application Express API Reference
Part Number E12855-01
APEX_APPLICATION package is a PL/SQL package that implements the Oracle Application Express rendering engine. You can use this package to take advantage of a number of global variables. Table 4-1 describes the global variables available in the
Table 4-1 Global Variables Available in APEX_APPLICATION
Specifies the currently logged in user.
Specifies the ID of the currently running application.
Specifies the ID of the currently running page.
Specifies the schema to parse for the currently running application.
Specifies the value of the request variable most recently passed to or set within the show or accept modules.
Topics in this section include:
Items are typically HTML form elements such as text fields, select lists, and check boxes. When you create a new form item using a wizard, the wizard uses a standard naming format. The naming format provides a handle so you can retrieve the value of the item later on.
If you need to create your own items, you can access them after a page is submitted by referencing
APEX_APPLICATION.G_F50 arrays. You can create your own HTML form fields by providing the input parameters using the format
F03 and so on. You can create up to 50 input parameters ranging from
F50, for example:
<INPUT TYPE="text" NAME="F01" SIZE="32" MAXLENGTH="32" VALUE="some value"> <TEXTAREA NAME="F02" ROWS=4 COLS=90 WRAP="VIRTUAL">this is the example of a text area.</TEXTAREA> <SELECT NAME="F03" SIZE="1"> <OPTION VALUE="abc">abc <OPTION VALUE="123">123 </SELECT>
F50 input items are declared as PL/SQL arrays, you can have multiple items named the same value. For example:
<INPUT TYPE="text" NAME="F01" SIZE="32" MAXLENGTH="32" VALUE="array element 1"> <INPUT TYPE="text" NAME="F01" SIZE="32" MAXLENGTH="32" VALUE="array element 2"> <INPUT TYPE="text" NAME="F01" SIZE="32" MAXLENGTH="32" VALUE="array element 3">
Note that following PL/SQL code produces the same HTML as show in the previous example.
FOR i IN 1..3 LOOP APEX_ITEM.TEXT(P_IDX => 1, p_value =>'array element '||i , p_size =>32, p_maxlength =>32); END LOOP;
You can reference the values posted by an HTML form using the PL/SQL variable
G_F50. Because this element is an array, you can reference values directly, for example:
FOR i IN 1.. APEX_APPLICATION.G_F01.COUNT LOOP htp.p('element '||I||' has a value of '||APEX_APPLICATION.G_F01(i)); END LOOP;
Note that check boxes displayed using
APEX_ITEM.CHECKBOX will only contain values in the
APEX_APPLICATION arrays for those rows which are checked. Unlike other items (
DATE_POPUP) which can contain an entry in the corresponding
APEX_APPLICATION array for every row submitted, a check box will only have an entry in the
APEX_APPLICATION array if it is selected.
You can also use Oracle Application Express public utility functions to convert an array into a single value. The resulting string value is a colon-separated list of the array element values. The resulting string value is a colon-separated list of the array element values. For example:
This function enables you to reference
G_F50 values in an application process that performs actions on data. The following sample process demonstrates how values are inserted into a table:
INSERT INTO my_table (my_column) VALUES APEX_UTIL.TABLE_TO_STRING(APEX_APPLICATION.G_F01)