Previous |
Next |
A collection is a PL/SQL composite variable that stores elements of the same type in a specified order, similar a one-dimensional array. The internal components of a collection are called elements. Each element has a unique subscript that identifies its position in the collection. To access a collection element, you use subscript notation: collection_name
(element_subscript
).
You can treat collection elements like scalar variables. You can also pass entire collections as subprogram parameters (if neither the sending nor receiving subprogram is a standalone subprogram).
A collection method is a built-in PL/SQL subprogram that either returns information about a collection or operates on a collection. To invoke a collection method, you use dot notation: collection_name
.method
. For example, collection_name
.COUNT
returns the number of elements in the collection.
PL/SQL has three types of collections:
Associative arrays (formerly called "PL/SQL tables" or "index-by tables")
This document explains only associative arrays.
Oracle Database PL/SQL Language Reference for more information about PL/SQL collection types
Oracle Database PL/SQL Language Reference for more information about collection methods