Collections Overview
Let’s start with a review of collection concepts and terminology, a description of the different types of collections, and a number of examples to get you going.
Collections Concepts and Terminology
The following explanations will help you understand collections and more rapidly establish a comfort level with these data structures.
- Element and index value
A collection consists of multiple elements (chunks of data), each element of which is located at a certain index value in the list. You will sometimes see an element also referred to as a “row,” and an index value referred to as the “row number.”
- Collection type
Each collection variable in your program must be declared based on a predefined collection type. As I mentioned earlier, there are, very generally, three types of collections: associative arrays, nested tables, and VARRAYs. Within those generic types, there are specific types that you define with a TYPE statement in a block’s declaration section. You can then declare and use instances of those types in your programs.
- Collection or collection instance
The term “collection” may refer to any of the following:
A PL/SQL variable of type associative array, nested table, or VARRAY
A table column of type nested table or VARRAY
Regardless of the particular type or usage, however, a collection is at its core a single-dimensional list of homogeneous elements.
A collection instance is an instance of a particular type of collection.
Partly due to the syntax and names Oracle ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access