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 

Collections

A collection is a way to work with a set of data without committing it to the base database tables.  The concept is very much like a shopping cart.  The data is collected, then, when all the necessary data has been collected, it can be inserted into a table, or tables, from the collection.  Another way to put it is a collection works like persistent session state for a multi-dimensional array of data.

The data in a collection can only be seen by the session that created it.  Also, a session can have many collections.  For example, there may be one collection for books and another collection for music CDs.

If you have downloaded and installed the EASY Samples application from the code depot, you will be able reference it with the explanations that follow.  The collections page ID is 1132.

The explanation provided here will be a departure from the way things have been done so far.  The normal process walks through the steps to create all the components, but since collections are an intermediate to advanced topic, it is assumed you already know how to create the components necessary.

A collection stores data in a character format.  It can store up to 50 elements plus a CLOB.  The 50 columns are of data type varchar2(4000).

Working with Collections

The use of collections utilizes some of the HTML DB API.  The package for this process is htmldb_collection.  This package has several procedures and functions.

Creating a Collection

The collection being created here is a subset of the CONFERENCE_RSVP table.  The code is in the Create Collection process on page 1132 of the EASY Samples application.

if htmldb_collection.collection_exists( 'CONF') = TRUE then 

  htmldb_collection.delete_collection( 'CONF' );
 

end if; 

htmldb_collection.create_collection_from_query(
  p_collection_name => 'CONF',
  p_query       => 'select id, last_name, first_name, rsvp_date,
                     company, ''O''
                from  conference_rsvp
                where  payment = ''Check''',
  p_generate_md5  => 'YES'); 

htmldb_collection.reset_collection_changed( 'CONF' );

While creating the collection above, the first step is to check to see if the collection exists.  If it does, it is deleted.  Then, the CONF collection can be created using a query to populate it.


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 -2016 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