 |
|
ss
Oracle Tips by Burleson |
Working
with List Manager
There are two ways of handling the values. The
use of INSTR for this item type is impracticable since the values
entered would be unknown.
1.
The string can be kept as a colon-delimited string and stored
in the database.
2.
The list can be processed by utilizing the HTML DB API function
called HTMLDB_UTIL.STRING_TO_TABLE. This function takes the result
string and turns it into a PL/SQL array. The array can be processed
in any manner. The following is an example of use:
declare
list_items htmldb_application_global.vc_arr2;
begin
--
-- convert the colon separated string of values into
-- a pl/sql array
list_items := htmldb_util.string_to_table(
:P1_EMAIL_ADDRESS );
--
-- loop over array to insert items into a table
for i in 1..list_items.count
loop
insert into email_addresses_table
values (list_items(i));
end loop;
end;
The reverse of this PL/SQL code can be
performed in order to reassemble the value for the page item.
declare
item_list htmldb_application_global.vc_arr2;
i integer := 1;
begin
for r in( select customer_email_address
from email_address_table) loop
item_list(i) := r.class_id;
i := i + 1;
end loop;
:P1_EMAIL_ADDRESS :=
htmldb_util.table_to_string( item_list, ':' );
end;
The above book excerpt is from:
Easy HTML-DB
Oracle Application Express
Create
Dynamic Web Pages with OAE
ISBN 0-9761573-1-4
Michael Cunningham & Kent Crotty
http://www.rampant-books.com/book_2005_2_html_db.htm
|