The HTMLDB_APPLICATION
package is a PL/SQL package that implements the Oracle HTML DB rendering engine. You can use this package to take advantage of a number of global variables. Table 16-49 describes the global variables available in HTMLDB_APPLICATION
.
Table 16-49 Global Variables Available in HTMLDB_APPLICATION
Global Variable | Description |
---|---|
|
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:
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 HTMLDB_APPLICATION.G_F01
to HTMLDB_APPLICATION.G_F50
arrays. You can create your own HTML form fields by providing the input parameters using the format F01
, F02
, F03
and so on. You can create up to 50 input parameters ranging from F01
to F50
. Consider the following 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>
Since the F01
to 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" ALUE="array element 2"> <INPUT TYPE="text" NAME="F01" SIZE="32" MAXLENGTH="32" VALUE="array element 3">
Note that following PL/SQL produces the same HTML as show in the previous example.
FOR i IN 1..3 LOOP HTMLDB_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 HTMLDB_APPLICATION
.G_F01
to HTMLDB_APPLICATION
.G_F50
. Since this element is an array you can reference values directly. For example:
FOR i IN 1.. HTMLDB_APPLICATION.G_F01.COUNT LOOP htp.p('element '||I||' has a value of '||HTMLDB_APPLICATION.G_F01(i)); END LOOP;
Note that check boxes displayed using HTMLDB_ITEM.CHECKBOX
will only contain values in the HTMLDB_APPLICATION
arrays for those rows which are checked. Unlike other items (TEXT, TEXTAREA, DATE_POPUP) which can contain an entry in the corresponding HTMLDB_APPLICATION
array for every row submitted, a check box will only have an entry in the HTMLDB_APPLICATION
array if it is selected.
You can also use Oracle HTML DB 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:
htp.p(HTMLDB_UTIL.TABLE_TO_STRING(HTMLDB_APPLICATION.G_F01));
This function is enables you to reference G_F01
to G_F50
values in an application process that performs actions on data. The following sample process demonstrates the insertion of values into an table:
FOR i IN 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP INSERT INTO my_table (my_column) VALUES HTMLDB_APPLICATION.G_F01(i); END LOOP;