Collections stores sets of elements : Introduction « Collections « Oracle PL/SQL Tutorial

Oracle PL/SQL Tutorial
1. Introduction
2. Query Select
3. Set
4. Insert Update Delete
5. Sequences
6. Table
7. Table Joins
8. View
9. Index
10. SQL Data Types
11. Character String Functions
12. Aggregate Functions
13. Date Timestamp Functions
14. Numerical Math Functions
15. Conversion Functions
16. Analytical Functions
17. Miscellaneous Functions
18. Regular Expressions Functions
19. Statistical Functions
20. Linear Regression Functions
21. PL SQL Data Types
22. PL SQL Statements
23. PL SQL Operators
24. PL SQL Programming
25. Cursor
26. Collections
27. Function Procedure Packages
28. Trigger
29. SQL PLUS Session Environment
30. System Tables Data Dictionary
31. System Packages
32. Object Oriented
33. XML
34. Large Objects
35. Transaction
36. User Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Oracle PL/SQL Tutorial » Collections » Introduction 
26. 1. 1. Collections stores sets of elements

There are three types of collections:

Varrays,Nested tables,Associative arrays (formerly known as index-by tables)

A varray is similar to an array in Java.

You can use a varray to store an ordered set of elements having an index associated with it.

The elements in a varray are of the same type.

A varray has one dimension.

A varray has a maximum size that you set when creating it.

Elements in a varray can only be modified as a whole, not individually.

You can change the size of a varray later.

The elements stored in a varray are stored with the table when the size of the varray is 4KB or less, otherwise the varray is stored outside of the table.

When a varray is stored with the table, accessing its elements is faster than accessing elements in a nested table.

A nested table is a table that is embedded within another table.

You can insert, update, and delete individual elements in a nested table.

Because you can modify individual elements in a nested table, this makes them more flexible than a varray.

A nested table doesn't have a maximum size, and you can store an arbitrary number of elements in a nested table.

The elements for nested tables are stored in separate tables.

Associative arrays is formerly known as index-by tables.

An associative array is a set of key and value pairs.

You can get the value from the array using the key (which may be a string) or an integer.

An associative array is similar to a hash table.

You create a collection type using the SQL DDL CREATE TYPE statement.

Then you can use these types to define columns in a table.

An associative array is a PL/SQL construct, not a SQL construct.

An associative array cannot be stored persistently in a table.

You might be asking yourself why you would want to use collections in the first place.

After all, using two tables with a foreign key already allows you to model relationships between data.

The answer is that the data stored in the collection may be accessed more rapidly by the database than if you were to use two tables instead.

Typically, you'll want to use a collection if you have data that is only used by one table.

Quote from:

Oracle Database 10g SQL (Osborne ORACLE Press Series) (Paperback)

# Paperback: 608 pages

# Publisher: McGraw-Hill Osborne Media; 1st edition (February 20, 2004)

# Language: English

# ISBN-10: 0072229810

# ISBN-13: 978-0072229813

26. 1. Introduction
26. 1. 1. Collections stores sets of elements
26. 1. 2. Multilevel Collection Types
26. 1. 3. List of Collection methods
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.