You can use the HTMLDB_ITEM
package to create form elements dynamically based on a SQL query instead of creating individual items page by page.
Topics:
This function creates check boxes.
Syntax
HTMLDB_ITEM.CHECKBOX( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT, p_attributes IN VARCHAR2 DEFAULT, p_checked_values IN VARCHAR2 DEFAULT, p_checked_values_delimiter IN VARCHAR2 DEFAULT) RETURN VARCHAR2;
Parameters
Table 16-29 describes the parameters available in the CHECKBOX
function.
Table 16-29 CHECKBOX Parameters
Parameter | Description |
---|---|
|
Number which determines which |
|
Value of a check box, hidden field, or input form item. |
|
Controls HTML tag attributes (such as disabled). |
|
Values to be checked by default. |
|
Delimits the values in the previous parameter, |
Examples of Default Check Box Behavior
The following example demonstrates how to create a selected check box for each employee in the emp
table.
SELECT HTMLDB_ITEM.CHECKBOX(1,empno,'CHECKED') " ", ename, job FROM emp ORDER BY 1
The next example demonstrates how to have all check boxes for employees display without being selected.
SELECT HTMLDB_ITEM.CHECKBOX(1,empno) " ", ename, job FROM emp ORDER BY 1
The next example demonstrates how to select the check boxes for employees who work in department 10.
SELECT HTMLDB_ITEM.CHECKBOX(1,empno,DECODE(deptno,10,'CHECKED',null)) " ", ename, job FROM emp ORDER BY 1
The next example demonstrates how to select the check boxes for employees who work in department 10 or department 20.
SELECT HTMLDB_ITEM.CHECKBOX(1,deptno,NULL,'10:20',':') " ", ename, job FROM emp ORDER BY 1
Creating an On-Submit Process
If you are using check boxes in your application, you might need to create an On Submit process to perform a specific type of action on the selected rows. For example, you could have a Delete button that utilizes the following logic:
SELECT HTMLDB_ITEM.CHECKBOX(1,empno) " ", ename, job FROM emp ORDER by 1
Consider the following sample on-submit process:
FOR I in 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP DELETE FROM emp WHERE empno = to_number(HTMLDB_APPLICATION.G_F01(i)); END LOOP;
Use this function with forms that include date fields. DATE_POPUP dynamically generates a date field that has popup calendar button.
Syntax
HTMLDB_ITEM.DATE_POPUP( p_idx IN NUMBER, p_row IN NUMBER, p_value IN VARCHAR2 DEFAULT, p_date_format IN DATE DEFAULT, p_size IN NUMBER DEFAULT, p_maxlength IN NUMBER DEFAULT, p_attributes IN VARCHAR2 DEFAULT) RETURN VARCHAR2;
Parameters
Table 16-30 describes the parameters available in the DATE_POPUP
function.
Table 16-30 DATE_POPUP Parameters
Parameter | Description |
---|---|
|
Number which determines which |
|
p_row is deprecated. Anything specified for this value will be ignored. |
|
Value of a field item. |
|
Valid database date format. |
|
Controls HTML tag attributes (such as disabled). |
|
Determine the maximum number of enterable characters. Becomes the maxlength attribute of the <input > HTML tag. |
|
Extra HTML parameters you want to add. |
See Also: Oracle Database SQL Reference for information about the TO_CHAR or TO_DATE functions |
Example
The following example demonstrates how to use HTMLDB_ITEM.DATE_POPUP
to create popup calendar buttons for the hiredate
column.
SELECT empno, HTMLDB_ITEM.HIDDEN(1,empno)|| HTMLDB_ITEM.TEXT(2,ename) ename, HTMLDB_ITEM.TEXT(3,job) job, mgr, HTMLDB_ITEM.DATE_POPUP(4,rownum,hiredate,'dd-mon-yyyy') hd, HTMLDB_ITEM.TEXT(5,sal) sal, HTMLDB_ITEM.TEXT(6,comm) comm, deptno FROM emp ORDER BY 1
Use this function to display an item as text, but save its value to session state.
Syntax
HTMLDB_ITEM.DISPLAY_AND_SAVE( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT NULL p_item_id IN VARCHAR2 DEFAULT NULL, p_item_label IN VARCHAR2 DEFAULT NULL) RETURN VARCHAR2;
Parameters
Table 16-31 describes the parameters available in the DISPLAY_AND_SAVE
.
Table 16-31 DISPLAY_AND_SAVE Parameters
Parameter | Description |
---|---|
|
Number which determines which |
|
Current value. |
|
HTML attribute ID for the |
|
Label of the text field item. |
Example
The following example demonstrates how to use HTMLDB_ITEM.DISPLAY_AND_SAVE.
SELECT HTMLDB_ITEM.DISPLAY_AND_SAVE(10,empno) c FROM emp
This function dynamically generates hidden form items.
Syntax
HTMLDB_ITEM.HIDDEN( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT) RETURN VARCHAR2;
Parameters
Table 16-32 describes the parameters available in the HIDDEN
function.
Table 16-32 HIDDEN Parameters
Parameter | Description |
---|---|
|
Number to identify the item you want to generate. The number will determine which See Also: "HTMLDB_APPLICATION" |
|
Value of the hidden input form item. |
Example
Typically, the primary key of a table is stored as a hidden column and used for subsequent update processing. Consider the following sample SLQ query:
SELECT empno, HTMLDB_ITEM.HIDDEN(1,empno)|| HTMLDB_ITEM.TEXT(2,ename) ename, HTMLDB_ITEM.TEXT(3,job) job, mgr, HTMLDB_ITEM.DATE_POPUP(4,rownum,hiredate,'dd-mon-yyyy') hiredate, HTMLDB_ITEM.TEXT(5,sal) sal, HTMLDB_ITEM.TEXT(6,comm) comm, deptno FROM emp ORDER BY 1
The previous query could use the following page process to process the results:
BEGIN FOR i IN 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP UPDATE emp SET ename=HTMLDB_APPLICATION.G_F02(i), job=HTMLDB_APPLICATION.G_F03(i), hiredate=to_date(HTMLDB_APPLICATION.G_F04(i),'dd-mon-yyyy'), sal=HTMLDB_APPLICATION.G_F05(i), comm=HTMLDB_APPLICATION.G_F06(i) WHERE empno=to_number(HTMLDB_APPLICATION.G_F01(i)); END LOOP; END;
Note that the G_F01
column (which corresponds to the hidden EMPNO
) is used as the key to update each row.
This function passes values to HTMLDB_ITEM
.MULTI_ROW_UPDATE
and is used for lost update detection. Lost update detection ensures data integrity in applications where data can be accessed concurrently.
Syntax
HTMLDB_ITEM.MD5_CHECKSUM( p_value01 IN VARCHAR2 DEFAULT, p_value02 IN VARCHAR2 DEFAULT, p_value03 IN VARCHAR2 DEFAULT, ... p_value50 IN VARCHAR2 DEFAULT, p_col_sep IN VARCHAR2 DEFAULT) RETURN VARCHAR2;
Parameters
Table 16-34 describes the parameters available in the MD5_CHECKSUM
function.
Table 16-33 MD5_HIDDEN Parameters
Parameter | Description |
---|---|
...
|
Fifty available inputs. Parameters that are not supplied default to null. |
|
String used to separate |
Example
SELECT HTMLDB_ITEM.MD5_CHECKSUM(ename,job,sal) FROM emp
This function is used for lost update detection which ensures data integrity in applications where data can be accessed concurrently.
This function produces a hidden form field and includes 50 inputs. HTMLDB_ITEM
.MD5_HIDDEN
also produces an MD5 checksum using the Oracle database DBMS_OBFUSCATION_TOOLKIT
:
UTL_RAW.CAST_TO_RAW(DBMS_OBFUSCATION_TOOLKIT.MD5())
An MD5 checksum provides data integrity through hashing and sequencing to assure that data is not altered or stolen as it is transmitted over a network
Syntax
HTMLDB_ITEM.MD5_HIDDEN( p_idx IN NUMBER, p_value01 IN VARCHAR2 DEFAULT, p_value02 IN VARCHAR2 DEFAULT, p_value03 IN VARCHAR2 DEFAULT, ... p_value50 IN VARCHAR2 DEFAULT, p_col_sep IN VARCHAR2 DEFAULT) RETURN VARCHAR2;
Parameters
Table 16-34 describes the parameters available in the MD5_HIDDEN
function.
Table 16-34 MD5_HIDDEN Parameters
Parameter | Description |
---|---|
|
Indicates the form element to be generated. For example, 1 equals |
...
|
Fifty available inputs. Parameters not supplied default to null. |
|
String used to separate |
Example
p_idx
specifies the FXX form element to be generated. In the following example, 7 generates F07
. Also note that an HTML hidden form element will be generated.
SELECT HTMLDB_ITEM.MD5_HIDDEN(7,ename,job,sal), ename, job, sal FROM emp
Use this procedure within a Multi Row Update process type. This procedure takes a string containing a multiple row update definition in the following format:
OWNER:TABLE:pk_column1,pk_idx:pk_column2,pk_idx2|col,idx:col,idx...
Syntax
HTMLDB_ITEM.MULTI_ROW_UPDATE( p_mru_string IN VARCHAR2 DEFAULT) RETURN VARCHAR2;
Example
To use this procedure indirectly within application-level process, you need to create a query to generate a form of database data. The following example demonstrates how to create a multiple row update on the emp
table.
SELECT empno, HTMLDB_ITEM.HIDDEN(1,empno), HTMLDB_ITEM.HIDDEN(2,deptno), HTMLDB_ITEM.TEXT(3,ename), HTMLDB_ITEM.SELECT_LIST_FROM_QUERY(4,job,'SELECT DISTINCT job FROM emp'), HTMLDB_ITEM.TEXT(5,sal), HTMLDB_ITEM.TEXT(7,comm), HTMLDB_ITEM.MD5_CHECKSUM(ename,job,sal,comm), deptno FROM emp WHERE deptno = 20
Note the call to HTMLDB_ITEM.MD5_CHECKSUM
instead of HTMLDB_ITEM.MD5_HIDDEN
. Since HTMLDB_ITEM.MULTI_ROW_UPDATE
gets the checksum from HTMLDB_APPLICATION.G_FCS
, you need to call HTMLDB_ITEM.MD5_CHECKSUM
in order to populate HTMLDB_APPLICATION.G_FCS
when the page is submitted. Additionally, the columns in HTMLDB_ITEM.MD5_CHECKSUM
must be in the same order those in the MULTI_ROW_UPDATE
process. These updates can then processed (or applied to the database) using an after submit page process of Multi Row Update in a string similar to the following:
SCOTT:emp:empno,1:deptno,2|ename,3:job,4:sal,5:comm,7:,:,:,:,
This function generates an HTML popup select list from an application list of values (LOV). Like other available functions in the HTMLDB_ITEM
package, POPUP_FROM_LOV
is designed to generate forms with F01
to F50
form array elements.
Syntax
HTMLDB_ITEM.POPUP_FROM_LOV( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT, p_lov_name IN VARCHAR2, p_width IN VARCHAR2 DEFAULT, p_max_length IN VARCHAR2 DEFAULT, p_form_index IN VARCHAR2 DEFAULT, p_escape_html IN VARCHAR2 DEFAULT, p_max_elements IN VARCHAR2 DEFAULT, p_attributes IN VARCHAR2 DEFAULT, p_ok_to_query IN VARCHAR2 DEFAULT, p_item_id IN VARCHAR2 DEFAULT NULL, p_item_label IN VARCHAR2 DEFAULT NULL) RETURN VARCHAR2;
Parameters
Table 16-35 describes the some parameters in the POPUP_FROM_LOV
function.
Table 16-35 POPUP_FROM_LOV Parameters
Parameter | Description |
---|---|
|
Form element name. For example, |
|
Form element current value. This value should be one of the values in the |
|
Named LOV used for this popup. |
|
Width of the text box. |
|
Maximum number of characters that can be entered in the text box. |
|
HTML form on the page in which an item is contained. Defaults to 0 and rarely used. Only use this parameter when it is necessary to embed a custom form in your page template (such as a search field which posts to a different Web site). If this form comes before the |
|
Replacements for special characters that require an escaped equivalent.
Range of values is YES and NO. If YES, special characters will be escaped. This parameter is useful if you know your query will return illegal HTML. |
|
Limit on the number of rows that can be returned by your query. Limits the performance impact of user searches. By entering a value in this parameter, you force the user to search for a more narrow set of results. |
|
Additional HTML attributes to use for the form item. |
|
Range of values is |
|
ID attribute of the form element. |
|
Invisible label created for the item. |
Example
The following example demonstrates a sample query the generates a popup from a LOV named DEPT
.
SELECT HTMLDB_ITEM.POPUP_FROM_LOV (1,deptno,'DEPT_LOV') dt FROM emp
This function generates an HTML popup select list from a query. Like other available functions in the HTMLDB_ITEM
package, POPUP_FROM_QUERY
is designed to generate forms with F01
to F50
form array elements.
Syntax
HTMLDB_ITEM.POPUP_FROM_QUERY( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT, p_lov_query IN VARCHAR2, p_width IN VARCHAR2 DEFAULT, p_max_length IN VARCHAR2 DEFAULT, p_form_index IN VARCHAR2 DEFAULT, p_escape_html IN VARCHAR2 DEFAULT, p_max_elements IN VARCHAR2 DEFAULT, p_attributes IN VARCHAR2 DEFAULT, p_ok_to_query IN VARCHAR2 DEFAULT, p_item_id IN VARCHAR2 DEFAULT NULL, p_item_label IN VARCHAR2 DEFAULT NULL) RETURN VARCHAR2;
Parameters
Table 16-36 describes the parameters in the POPUP_FROM_QUERY
function.
Table 16-36 POPUP_FROM_QUERY Parameters
Parameter | Description |
---|---|
|
Form element name. For example, |
|
Form element current value. This value should be one of the values in the |
|
SQL query that is expected to select two columns (a display column and a return column). For example: SELECT dname, deptno FROM dept |
|
Width of the text box. |
|
Maximum number of characters that can be entered in the text box. |
|
HTML form on the page in which an item is contained. Defaults to 0 and rarely used. Only use this parameter when it is necessary to embed a custom form in your page template (such as a search field which posts to a different Web site). If this form comes before the |
|
Replacements for special characters that require an escaped equivalent.
Range of values is YES and NO. If YES, special characters will be escaped. This parameter is useful if you know your query will return illegal HTML. |
|
Limit on the number of rows that can be returned by your query. Limits the performance impact of user searches. By entering a value in this parameter, you force the user to search for a more narrow set of results. |
|
Additional HTML attributes to use for the form item. |
|
Range of values is |
|
ID attribute of the form element. |
|
Invisible label created for the item. |
Example
The following example demonstrates a sample query the generates a popup select list from the emp
table.
SELECT HTMLDB_ITEM.POPUP_FROM_QUERY (1,deptno,'SELECT dname, deptno FROM dept') dt FROM emp
This function generates a popup key select list from a shared list of values (LOV). Like other available functions in the HTMLDB_ITEM
package, POPUPKEY_FROM_LOV
is designed to generate forms with F01
to F50
form array elements.
Syntax
HTMLDB_ITEM.POPUPKEY_FROM_LOV( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT, p_lov_name IN VARCHAR2, p_width IN VARCHAR2 DEFAULT, p_max_length IN VARCHAR2 DEFAULT, p_form_index IN VARCHAR2 DEFAULT, p_escape_html IN VARCHAR2 DEFAULT, p_max_elements IN VARCHAR2 DEFAULT, p_attributes IN VARCHAR2 DEFAULT, p_ok_to_query IN VARCHAR2 DEFAULT, RETURN VARCHAR2;
Although the text field associated with the popup displays in the first column in the LOV query, the actual value is specified in the second column in the query.
Parameters
Table 16-37 describes the some parameters in the POPUPKEY_FROM_LOV
function.
Table 16-37 POPUPKEY_FROM_LOV Parameters
Parameter | Description |
---|---|
|
Identifies a form element name. For example, Because of the behavior of SELECT HTMLDB_ITEM.POPUPKEY_FROM_LOV (1,deptno,'DEPT') dt, HTMLDB_ITEM.HIDDEN(3,empno) eno |
|
Indicates the current value. This value should be one of the values in the |
|
Identifies a named LOV used for this popup. |
|
Width of the text box. |
|
Maximum number of characters that can be entered in the text box. |
|
HTML form on the page in which an item is contained. Defaults to 0 and rarely used. Only use this parameter when it is necessary to embed a custom form in your page template (such as a search field which posts to a different Web site). If this form comes before the |
|
Replacements for special characters that require an escaped equivalent.
This parameter is useful if you know your query will return illegal HTML. |
|
Limit on the number of rows that can be returned by your query. Limits the performance impact of user searches. By entering a value in this parameter, you force the user to search for a more narrow set of results. |
|
Additional HTML attributes to use for the form item. |
|
Range of values is |
Example
The following example demonstrates how to generate a popup key select list from a shared list of values (LOV).
SELECT HTMLDB_ITEM.POPUPKEY_FROM_LOV (1,deptno,'DEPT') dt FROM emp
This function generates a popup key select list from a SQL query. Like other available functions in the HTMLDB_ITEM
package, POPUPKEY_FROM_QUERY
is designed to generate forms with F01
to F50
form array elements.
Syntax
HTMLDB_ITEM.POPUPKEY_FROM_QUERY( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT, p_lov_query IN VARCHAR2, p_width IN VARCHAR2 DEFAULT, p_max_length IN VARCHAR2 DEFAULT, p_form_index IN VARCHAR2 DEFAULT, p_escape_html IN VARCHAR2 DEFAULT, p_max_elements IN VARCHAR2 DEFAULT, p_attributes IN VARCHAR2 DEFAULT, p_ok_to_query IN VARCHAR2 DEFAULT, p_item_id IN VARCHAR2 DEFAULT NULL, p_item_label IN VARCHAR2 DEFAULT NULL) RETURN VARCHAR2;
Parameters
Table 16-38 describes the some parameters in the POPUPKEY_FROM_QUERY
function.
Table 16-38 POPUPKEY_FROM_QUERY Parameters
Parameter | Description |
---|---|
|
Form element name. For example, Because of the behavior of SELECT HTMLDB_ITEM.POPUPKEY_FROM_QUERY (1,deptno,'SELECT dname, deptno FROM dept') dt, HTMLDB_ITEM.HIDDEN(3,empno) eno |
|
Form element current value. This value should be one of the values in the |
|
LOV query used for this popup. |
|
Width of the text box. |
|
Maximum number of characters that can be entered in the text box. |
|
HTML form on the page in which an item is contained. Defaults to 0 and rarely used. Only use this parameter when it is necessary to embed a custom form in your page template (such as a search field which posts to a different Web site). If this form comes before the |
|
Replacements for special characters that require an escaped equivalent.
This parameter is useful if you know your query will return illegal HTML. |
|
Limit on the number of rows that can be returned by your query. Limits the performance impact of user searches. By entering a value in this parameter, you force the user to search for a more narrow set of results. |
|
Additional HTML attributes to use for the form item. |
|
Range of values is |
|
ID attribute of the form element. |
|
Invisible label created for the item. |
Example
The following example demonstrates how to generate a popup select list from a SQL query.
SELECT HTMLDB_ITEM.POPUPKEY_FROM_QUERY (1,deptno,'SELECT dname, deptno FROM dept') dt FROM emp
This function generates a radio group from a SQL query.
Syntax
HTMLDB_ITEM.RADIOGROUP( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT, p_selected_value IN VARCHAR2 DEFAULT, p_display IN VARCHAR2 DEFAULT, p_attributes IN VARCHAR2 DEFAULT, p_onblur IN VARCHAR2 DEFAULT, p_onchange IN VARCHAR2 DEFAULT, p_onfocus IN VARCHAR2 DEFAULT,) RETURN VARCHAR2;
Parameters
Table 16-39 describes the parameters available in the RADIOGROUP
function.
Table 16-39 RADIOGROUP Parameters
Parameter | Description |
---|---|
|
Number which determines which |
|
Value of the radio group. |
|
Value that should be "on", or selected. |
|
Text to display next to the radio option. |
|
Extra HTML parameters you want to add. |
|
JavaScript to execute in the onBlur event. |
|
JavaScript to execute in the onChange event. |
|
JavaScript to execute in the onFocus event. |
Example
The following example demonstrates how to select department 20 from the emp
table as a default in a radio group.
SELECT HTMLDB_ITEM.CHECKBOX(1,deptno,'20',dname) dt FROM dept ORDER BY 1
This function dynamically generates a static select list. Similar to other functions available in the HTMLDB_ITEM
package, these select list functions are designed to generate forms with F01
to F50
form array elements.
Syntax
HTMLDB_ITEM.SELECT_LIST( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT, p_list_values IN VARCHAR2 DEFAULT, p_attributes IN VARCHAR2 DEFAULT, p_show_null IN VARCHAR2 DEFAULT, p_null_value IN VARCHAR2 DEFAULT, p_null_text IN VARCHAR2 DEFAULT, p_item_id IN VARCHAR2 DEFAULT, p_item_label IN VARCHAR2 DEFAULT, p_show_extra IN VARCHAR2 DEFAULT) RETURN VARCHAR2;
Parameters
Table 16-40 describes the parameters available in the SELECT_LIST
function.
Table 16-40 SELECT_LIST Parameters
Parameter | Description |
---|---|
|
Form element name. For example, |
|
Current value. This value should be a value in the |
|
List of static values separated by commas. Display values and return values are separated by semicolons. Note that this is only available in the |
|
Extra HTML parameters you want to add. |
|
Extra select option to enable the NULL selection. Range of values is |
|
Value to be returned when a user selects the null option. Only relevant when |
|
Value to be displayed when a user selects the null option. Only relevant when |
|
HTML attribute ID for the <input> tag. |
|
Label of the select list. |
|
Show the current value even if the value of p_value is not located in the select list. |
Example
The following example demonstrates a static select list that displays Yes
, returns Y
, defaults to Y
, and generates a F01
form item.
SELECT HTMLDB_ITEM.SELECT_LIST(1,'Y','Yes;Y,No;N') FROM emp
This function dynamically generates select lists from a shared list of values (LOV). Similar to other functions available in the HTMLDB_ITEM
package, these select list functions are designed to generate forms with F01
to F50
form array elements.
Syntax
HTMLDB_ITEM.SELECT_LIST_FROM_LOV( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT, p_lov IN VARCHAR2, p_attributes IN VARCHAR2 DEFAULT, p_show_null IN VARCHAR2 DEFAULT, p_null_value IN VARCHAR2 DEFAULT, p_null_text IN VARCHAR2 DEFAULT, p_item_id IN VARCHAR2 DEFAULT, p_item_label IN VARCHAR2 DEFAULT) RETURN VARCHAR2;
Parameters
Table 16-41 describes the parameters available in the SELECT_LIST_FROM_LOV
function.
Table 16-41 SELECT_LIST_FROM_LOV Parameters
Parameter | Description |
---|---|
|
Form element name. For example, |
|
Current value. This value should be a value in the |
|
Text name of a application list of values. This list of values must be defined in your application. This parameter is used only by the |
|
Extra HTML parameters you want to add. |
|
Extra select option to enable the NULL selection. Range of values is |
|
Value to be returned when a user selects the null option. Only relevant when |
|
Value to be displayed when a user selects the null option. Only relevant when |
|
HTML attribute ID for the |
|
Label of the select list. |
Example
The following demonstrates a select list based on a LOV defined in the application.
SELECT HTMLDB_ITEM.SELECT_LIST_FROM_LOV(2,job,'JOB_FLOW_LOV') FROM emp
This function dynamically generates very large select lists (greater than 32K) from a shared list of values (LOV). Similar to other functions available in the HTMLDB_ITEM
package, these select list functions are designed to generate forms with F01
to F50
form array elements. This function is the same as SELECT_LIST_FROM_LOV
, but its return value is CLOB. This enables you to use it in SQL queries where you need to handle a column value longer than 4000 characters.
Syntax
HTMLDB_ITEM.SELECT_LIST_FROM_LOV_XL( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT, p_lov IN VARCHAR2, p_attributes IN VARCHAR2 DEFAULT, p_show_null IN VARCHAR2 DEFAULT, p_null_value IN VARCHAR2 DEFAULT, p_null_text IN VARCHAR2 DEFAULT, p_item_id IN VARCHAR2 DEFAULT, p_item_label IN VARCHAR2 DEFAULT) RETURN CLOB;
Parameters
Table 16-42 describes the parameters available in the SELECT_LIST_FROM_LOV_XL
function.
Table 16-42 SELECT_LIST_FROM_LOV_XL Parameters
Parameter | Description |
---|---|
|
Form element name. For example, |
|
Current value. This value should be a value in the |
|
Text name of a list of values. This list of values must be defined in your application. This parameter is used only by the |
|
Extra HTML parameters you want to add. |
|
Extra select option to enable the NULL selection. Range of values is |
|
Value to be returned when a user selects the null option. Only relevant when |
|
Value to be displayed when a user selects the null option. Only relevant when |
|
HTML attribute ID for the <input> tag. |
|
Label of the select list. |
Example
The following demonstrates a select list based on a LOV defined in the application.
SELECT HTMLDB_ITEM.SELECT_LIST_FROM_LOV_XL(2,job,'JOB_FLOW_LOV') FROM emp
This function is the same as This function dynamically generates a select list from a query. Similar to other functions available in the HTMLDB_ITEM
package, these select list functions are designed to generate forms with F01 to F50 form array elements.
Syntax
HTMLDB_ITEM.SELECT_LIST_FROM_QUERY( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT, p_query IN VARCHAR2, p_attributes IN VARCHAR2 DEFAULT, p_show_null IN VARCHAR2 DEFAULT, p_null_value IN VARCHAR2 DEFAULT, p_null_text IN VARCHAR2 DEFAULT, p_item_id IN VARCHAR2 DEFAULT, p_item_label IN VARCHAR2 DEFAULT, p_show_extra IN VARCHAR2 DEFAULT) RETURN VARCHAR2;
Parameters
Table 16-43 describes the parameters available in the SELECT_LIST_FROM_QUERY
function.
Table 16-43 SELECT_LIST_FROM_QUERY Parameters
Parameter | Description |
---|---|
|
Form element name. For example, |
|
Current value. This value should be a value in the |
|
SQL query that is expected to select two columns, a display column, and a return column. For example: SELECT dname, deptno FROM dept Note that this is used only by the |
|
Extra HTML parameters you want to add. |
|
Extra select option to enable the NULL selection. Range of values is |
|
Value to be returned when a user selects the null option. Only relevant when |
|
Value to be displayed when a user selects the null option. Only relevant when |
|
HTML attribute ID for the <input> tag. |
|
Label of the select list. |
|
Show the current value even if the value of p_value is not located in the select list. |
Example
The following demonstrates a select list based on a SQL query.
SELECT HTMLDB_ITEM.SELECT_LIST_FROM_QUERY(3,job,'SELECT DISTINCT job FROM emp') FROM emp
This function is the same as SELECT_LIST_FROM_QUERY
, but its return value is a CLOB. This allows its use in SQL queries where you need to handle a column value longer than 4000 characters. Similar to other functions available in the HTMLDB_ITEM
package, these select list functions are designed to generate forms with F01
to F50
form array elements.
Syntax
HTMLDB_ITEM.SELECT_LIST_FROM_QUERY_XL( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT, p_query IN VARCHAR2, p_attributes IN VARCHAR2 DEFAULT, p_show_null IN VARCHAR2 DEFAULT, p_null_value IN VARCHAR2 DEFAULT, p_null_text IN VARCHAR2 DEFAULT, p_item_id IN VARCHAR2 DEFAULT, p_item_label IN VARCHAR2 DEFAULT, p_show_extra IN VARCHAR2 DEFAULT) RETURN CLOB;
Parameters
Table 16-44 describes the parameters available in the SELECT_LIST_FROM_QUERY_XL
function.
Table 16-44 SELECT_LIST_FROM_QUERY_XL Parameters
Parameter | Description |
---|---|
|
Form element name. For example, |
|
Current value. This value should be a value in the |
|
SQL query that is expected to select two columns, a display column, and a return column. For example: SELECT dname, deptno FROM dept Note that this is used only by the |
|
Extra HTML parameters you want to add. |
|
Extra select option to enable the NULL selection. Range of values is |
|
Value to be returned when a user selects the null option. Only relevant when |
|
Value to be displayed when a user selects the null option. Only relevant when |
|
HTML attribute ID for the <input> tag. |
|
Label of the select list. |
|
Show the current value even if the value of p_value is not located in the select list. |
Example
The following demonstrates a select list based on a SQL query.
SELECT HTMLDB_ITEM.SELECT_LIST_FROM_QUERY_XL(3,job,'SELECT DISTINCT job FROM emp') FROM emp
This function creates text areas
Syntax
HTMLDB_ITEM.TEXTAREA( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT NULL, p_rows IN NUMBER DEAULT 40, p_cols IN NUMBER DEFAULT 4 p_attributes IN VARCHAR2 DEFAULT, p_item_id IN VARCHAR2 DEFAULT NULL, p_item_label IN VARCHAR2 DEFAULT NULL) RETURN VARCHAR2;
Parameters
Table 16-46 describes the parameters available in the TEXT
function.
Table 16-45 TEXTAREA Parameters
Parameter | Description |
---|---|
|
Number to identify the item you want to generate. The number will determine which See Also: "HTMLDB_APPLICATION" |
|
Value of a textarea item. |
p_rows |
Height of the textarea (HTML rows attribute) |
p_cols |
Width of the textarea (HTML cols attribute). |
|
Extra HTML parameters you want to add. |
|
HTML attribute ID for the |
|
Label of the text textarea item. |
Example
The following example demonstrates a textarea based on a SQL query.
SELECT HTMLDB_ITEM.TEXTAREA(3,ename,5,80) a FROM emp
This function generates text fields (or text input form items) from a SQL query.
Syntax
HTMLDB_ITEM.TEXT( p_idx IN NUMBER, p_value IN VARCHAR2 DEFAULT NULL, p_size IN NUMBER DEFAULT NULL, p_maxlength IN NUMBER DEFAULT NULL, p_attributes IN VARCHAR2 DEFAULT NULL, p_item_id IN VARCHAR2 DEFAULT NULL, p_item_label IN VARCHAR2 DEFAULT NULL)
Parameters
Table 16-46 describes the parameters available in the TEXT
function.
Table 16-46 TEXT Parameters
Parameter | Description |
---|---|
|
Number to identify the item you want to generate. The number will determine which See Also: "HTMLDB_APPLICATION" |
|
Value of a text field item. |
|
Controls HTML tag attributes (such as disabled). |
|
Maximum number of characters that can be entered in the text box. |
|
Extra HTML parameters you want to add. |
|
HTML attribute ID for the |
|
Label of the text field item. |
Example
The following sample query demonstrates how to generate one update field for each row. Note that the ename
, sal
, and comm
columns use the HTMLDB_ITEM
.TEXT
function to generate an HTML text field for each row. Also, notice that each item in the query is passed an unique p_idx
parameter to ensure that each column is stored in its own array.
SELECT empno, HTMLDB_ITEM.HIDDEN(1,empno)|| HTMLDB_ITEM.TEXT(2,ename) ename, HTMLDB_ITEM.TEXT(3,job) job, mgr, HTMLDB_ITEM.DATE_POPUP(4,rownum,hiredate,'dd-mon-yyyy') hiredate, HTMLDB_ITEM.TEXT(5,sal) sal, HTMLDB_ITEM.TEXT(6,comm) comm, deptno FROM emp ORDER BY 1
Use this function to display an item as text, deriving the display value of the named LOV.
Syntax
HTMLDB_ITEM.TEXT_FROM_LOV ( p_value IN VARCHAR2 DEFAULT NULL, p_lov IN VARCHAR2, p_null_text IN VARCHAR2 DEFAULT '%') RETURN VARCHAR2;
Parameters
Table 16-47 describes the parameters available in the TEXT_FROM_LOV
function.
Table 16-47 TEXT_FROM_LOV Parameters
Parameter | Description |
---|---|
|
Value of a field item. |
|
Text name of a shared list of values. This list of values must be defined in your application. |
|
Value to be displayed when the value of the field item is null or a corresponding entry is not located for the value |
Example
The following example demonstrates how to derive the display value from a named LOV (EMPNO_ENAME_LOV
).
SELECT HTMLDB_ITEM.TEXT_FROM_LOV(empno,'EMPNO_ENAME_LOV') c FROM emp
Use this function to display an item as text, deriving the display value from a list of values query.
Syntax
HTMLDB_ITEM.TEXT_FROM_LOV_QUERY (
p_value IN VARCHAR2 DEFAULT NULL,
p_query IN
VARCHAR2,
p_null_text IN VARCHAR2 DEFAULT '%')
RETURN VARCHAR2;
Parameters
Table 16-47 describes the parameters available in the TEXT_FROM_LOV_QUERY
function.
Table 16-48 TEXT_FROM_LOV_QUERY Parameters
Parameter | Description |
---|---|
|
Value of a field item. |
|
SQL query that is expected to select two columns, a display column and a return column. For example: SELECT dname, deptno FROM dept |
|
Value to be displayed when the value of the field item is null or a corresponding entry is not located for the value |
Example
The following how to derive the display value from a query.
SELECT HTMLDB_ITEM.TEXT_FROM_LOV_QUERY(empno,'SELECT ename, empno FROM emp') c from emp