Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 








  Oracle Database Tips by Donald Burleson

APEX checkboxes

Checkboxes are a rather tricky feature to grasp in APEX.  As with most components in APEX, creating them is relatively easy; however, updating the database with the values selected is another story.

For the explanation of the use of Checkboxes, a many-to-many database relationship involving three tables will be used.  This is a simple three table example for explanation purposes only.  The script file that can be used to create the data model and sample data is in the code depot with the file name create_checkbox_data.sql.  To try the samples provided below, load the script into the SQL Workshopand run it.

The following information includes two examples of the use of checkboxes.  One will be placing checkboxes in an HTML region, and the other will be putting checkboxes in a report which requires the APEX API for rendering the checkboxes.

Working with Checkbox Data

This is an example of working with checkboxes in an HTML region.  HTML region types are used for Forms.  The region created for the purposes of this example looks similar to Figure 10.2.

The region created was a Form region.  While creating the page, the Form on a Table or View option was selected for which type of Form page to create.  A Form Pagination process was then created to get the Next/Previous navigation through the records in the STUDENT table.  Finally, the checkboxes were added using an LOV named Classes.  The Classes LOV can be created using the following select statement.

select class_name d, class_id r
from  class
order by 1

Format of Data in Relation to Checkboxes

The checkbox item created above is named P2501_CLASS_ID.  The session state for Checkboxes needs to be understood before a developer can effectively work with them.  In Figure 10.2 above, there are three items selected:  History; Programming; and Spanish.  The data in the CLASS table looks like Figure 10.3:

The session state of checkboxes is set to a colon delimited list of values.  Based on the selections in Figure 10.2 and the data in the class table, the session state for the P2501_CLASS_ID page item is set to 2:3:1.  This is how APEX sets the session state for checkboxes.

Armed with the knowledge presented so far it is time to learn how to use some of the APEX API language to construct and destruct the session state for checkboxes.  This depends on whether the page is being rendered or processed after submit.

        During page rendering, it will be necessary to query the data out of the XR_STUDENT_CLASS table, construct a colon delimited string, and set the session state for the P2501_CLASS_ID page item.

        During page processing, it will be necessary to destruct the colon delimited string and insert each of the items into the XR_STUDENT_CLASS table.

Populating Form Checkboxes during Page Rendering

To set the checked value, ON or OFF, of checkboxes, the session state of a checkbox page item is set to a colon delimited string, such as 2:3:1.  However, data is not stored in a database table in that format.  Instead, the data may be stored in several rows of a table.  For this example, the table is XR_STUDENT_CLASS.  The next step is to loop through the records and construct the string.  The code to do this is displayed in file ch10_1.sql.

This code is used in an After Header process named Populate Class ID.  The PL/SQL above uses some of the HTML API to convert tabular data to a colon delimited string.  A subsequent chapter in this book provides more detail into using the APEX API's.

It should be clear that the Populate Class ID process must be executed after any process that sets the P2501_STUDENT_ID session state.  At that point, the code will loop through all the classes the student is signed up for and populate an array.  The htmldb_util.table_to_string function then converts the array to a colon delimited string and sets the session state for the P2501_CLASS_ID page item.

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

Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster


Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.