Oracle Consulting Oracle Training Oracle Support Development
Home
Catalog
Oracle Books
SQL Server Books
IT Books
Job Interview Books
eBooks
Rampant Horse Books
911 Series
Pedagogue Books

Oracle Software
image
Write for Rampant
Publish with Rampant
Rampant News
Rampant Authors
Rampant Staff
 Phone
 800-766-1884
Oracle News
Oracle Forum
Oracle Tips
Articles by our Authors
Press Releases
SQL Server Books
image
image

Oracle 11g Books

Oracle tuning

Oracle training

Oracle support

Remote Oracle

STATSPACK Viewer

Privacy Policy

 

   
 

ss

Oracle Tips by Burleson 

Working with Multiple Select Lists

When a page is submitted, the value of a Multiple Select List page item will become a list of values separated by colons.  For example, in Figure 10.25, the Blue, Green and Red values have been chosen.  The page item will be set to the value B:G:R since those are the corresponding results from the LOV. 

There are three ways to now process the value in the page item. 

1.       The string can be kept as a colon-delimited string and stored in the database.

2.       The INSTR function can be used to process the information.

--  Search to see if Blue is part of the string
if instr(:P1_MLIST,'B') > 0 then
  -- process Blue
else
  If instr(:P1_MLIST,'R') > 0 then
   -- process Red
else
  ...
end if;

3.       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
  selected_items htmldb_application_global.vc_arr2;
begin
  --
  -- convert the colon separated string of values into
  -- a pl/sql array
  selected_items := htmldb_util.string_to_table( :P1_MLIST
);
  --
  -- loop over array to insert items into a table
  for i in 1..selected_items.count
  loop
    insert into colors_table
    values ( selected_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
  selected_list  htmldb_application_global.vc_arr2;  i          integer := 1;
begin
  for r in( select color
        from  color_table ) loop
    selected_list(i) := r.class_id;
    i := i + 1;
  end loop;
 

  :P1_MLIST := htmldb_util.table_to_string( selected_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

 

Download your Oracle scripts now:

www.oracle-script.com

The definitive Oracle Script collection for every Oracle professional DBA

Linux Oracle commands syntax poster

ION Oracle tuning software

Oracle data dictionary reference poster



Oracle Forum

BC Oracle consulting support training

BC remote Oracle DBA   

 

   

 Copyright © 1996 -2017 by Burleson. All rights reserved.


Oracle® is the registered trademark of Oracle Corporation. SQL Server® is the registered trademark of Microsoft Corporation. 
Many of the designations used by computer vendors to distinguish their products are claimed as Trademarks