13.13 SELECT_LIST Function

This function dynamically generates a static select list. Similar to other functions available in the APEX_ITEM package, these select list functions are designed to generate forms with F01 to F50 form array elements.


    p_idx           IN   NUMBER,
    p_value         IN   VARCHAR2 DEFAULT NULL,
    p_list_values   IN   VARCHAR2 DEFAULT NULL,
    p_attributes    IN   VARCHAR2 DEFAULT NULL,
    p_show_null     IN   VARCHAR2 DEFAULT 'NO',
    p_null_value    IN   VARCHAR2 DEFAULT '%NULL%',
    p_null_text     IN   VARCHAR2 DEFAULT '%',
    p_item_id       IN   VARCHAR2 DEFAULT NULL,
    p_item_label    IN   VARCHAR2 DEFAULT NULL,
    p_show_extra    IN   VARCHAR2 DEFAULT 'YES')


Table 13-13 SELECT_LIST Parameters

Parameter Description


Form element name. For example, 1 equals F01 and 2 equals F02. Typically the P_IDX parameter is constant for a given column.


Current value. This value should be a value in the P_LIST_VALUES parameter.


List of static values separated by commas. Displays values and returns values that are separated by semicolons.

Note that this is only available in the SELECT_LIST function.


Extra HTML parameters you want to add.


Extra select option to enable the NULL selection. Range of values is YES and NO.


Value to be returned when a user selects the NULL option. Only relevant when p_show_null equals YES.


Value to be displayed when a user selects the NULL option. Only relevant when p_show_null equals YES.


HTML attribute ID for the <input> tag.


Invisible label created for the item.


Shows the current value even if the value of p_value is not located in the select list.


The following example demonstrates a static select list that displays Yes, returns Y, defaults to Y, and generates a F01 form item.

FROM emp

The following example demonstrates the use of APEX_ITEM.SELECT_LIST to generate a static select list where:

  • A form array element F03 is generated (p_idx parameter).

  • The initial value for each element is equal to the value for deptno for the row from emp (p_value parameter).

  • The select list contains 4 options (p_list_values parameter).

  • The text within the select list displays in red (p_attributes parameter).

  • A null option is displayed (p_show_null) and this option displays -Select- as the text (p_null_text parameter).

  • An HTML ID attribute is generated for each row, where #ROWNUM# is substituted for the current row rownum (p_item_id parameter). (So an ID of 'f03_4' is generated for row 4.)

  • A HTML label element is generated for each row (p_item_label parameter).

  • The current value for deptno is displayed, even if it is not contained with the list of values passed in the p_list_values parameter (p_show_extra parameter).

SELECT  empno "Employee #", 
    ename "Name",
        p_idx           =>   3,
        p_value         =>   deptno,
        p_list_values   =>   'ACCOUNTING;10,RESEARCH;20,SALES;30,OPERATIONS;40',
        p_attributes    =>   'style="color:red;"',
        p_show_null     =>   'YES',
        p_null_value    =>   NULL,
        p_null_text     =>   '-Select-',
        p_item_id       =>   'f03_#ROWNUM#',
        p_item_label    =>   'Label for f03_#ROWNUM#',
        p_show_extra    =>   'YES') "Department"
  FROM  emp;