try to populate
your list dinamically from a record group.
The format of query in the record group is like this:
SELECT to_char(id_title) value, title label
FROM t$title
order by title
then use the function from block's pre-select trigger:
/*
p_rg_name - name of record group
p_list_name - name of list-item
*/
PROCEDURE create_query_list (p_list_name VARCHAR2, p_rg_name VARCHAR2) IS
the_Rowcount NUMBER;
rg_id RecordGroup;
gc_id_label GroupColumn;
gc_id_value GroupColumn;
Exit_Function Exception;
status number;
BEGIN
Clear_List(p_list_name);
/*
** Determine if record group exists, and if so get its ID.
*/
rg_id := Find_Group( p_rg_name );
IF Id_Null(rg_id) THEN
msg_box2('Record Group '||p_rg_name||' does not exist.');
RAISE Exit_Function;
END IF;
/*
** Make sure the column name specified exists in the
** record Group.
*/
gc_id_label := Find_Column( p_rg_name||'.label');
IF Id_Null(gc_id_label) THEN
msg_box2('Column "label" does not exist.');
RAISE Exit_Function;
END IF;
gc_id_value := Find_Column( p_rg_name||'.value');
IF Id_Null(gc_id_value) THEN
msg_box2('Column "value" does not exist.');
RAISE Exit_Function;
END IF;
/*
** Get a count of the number of records in the record
** group
*/
status := Populate_Group( rg_id );
the_Rowcount := Get_Group_Row_Count( rg_id );
/*
** Loop through the records, getting the specified column’s
** value at each iteration and comparing it to ’the_value’
** passed in. Compare the values in a case insensitive
** manner.
*/
FOR j IN 1..the_Rowcount LOOP
Add_List_Element(p_list_name, j, GET_GROUP_CHAR_CELL( gc_id_label, j ) , to_number(GET_GROUP_CHAR_CELL( gc_id_value, j )));
END LOOP;
/*
** If we get here, we didn’t find any matches.
*/
RAISE Exit_Function;
EXCEPTION
WHEN Exit_Function THEN
RETURN;
END;