| Oracle® Database PL/SQL Language Reference 11g Release 2 (11.2) Part Number E17126-03 |
|
|
View PDF |
A collection method is a built-in PL/SQL subprogram that returns information about a collection or operates on a collection.
Topics:
Syntax

Semantics
collection_name
The name of a collection.
COUNT
A function that returns the number of elements in the collection, explained in "COUNT Collection Method".
DELETE
A procedure that deletes elements from the collection, explained in "DELETE Collection Method".
Restriction on DELETE If collection_name identifies a varray, you cannot specify indexes with DELETE.
index
A numeric expression whose value has data type PLS_INTEGER or a data type that can be implicitly converted to PLS_INTEGER (see "PLS_INTEGER and BINARY_INTEGER Data Types").
EXISTS
A function that returns TRUE if the indexth element of the collection exists and FALSE otherwise. For more information, see "EXISTS Collection Method".
Restriction on EXISTS You cannot use EXISTS if collection_name identifies an associative array.
EXTEND
A procedure that adds elements to the end of the collection, explained in "EXTEND Collection Method".
Restriction on EXTEND You cannot use EXTEND if collection_name identifies an associative array.
FIRST
A function that returns the first subscript in the collection, explained in "FIRST and LAST Collection Methods".
LAST
A function that returns the last subscript in the collection, explained in "FIRST and LAST Collection Methods".
LIMIT
A function that returns the maximum number of elements that the collection can have. If the collection has no maximum size, LIMIT returns NULL. For an example, see "LIMIT Collection Method".
NEXT
A function that returns the subscript of the succeeding existing element of the collection, if one exists. Otherwise, NEXT returns NULL. For more information, see "PRIOR and NEXT Collection Methods".
PRIOR
A function that returns the subscript of the preceding existing element of the collection, if one exists. Otherwise, NEXT returns NULL. For more information, see "PRIOR and NEXT Collection Methods".
TRIM
A procedure that deletes elements from the end of a collection, explained in "TRIM Collection Method".
Restriction on TRIM You cannot use TRIM if collection_name identifies an associative array.
number
The number of elements to delete from the end of a collection. The default is one.
Examples
Example 5-17, "DELETE Method with Associative Array Indexed by String"
Example 5-21, "FIRST and LAST Values for Associative Array Indexed by Integer"
Example 5-22, "FIRST and LAST Values for Associative Array Indexed by String"
Example 5-23, "Printing Varray with FIRST and LAST in FOR LOOP"
Example 5-24, "Printing Nested Table with FIRST and LAST in FOR LOOP"
Example 5-27, "LIMIT and COUNT Values for Different Collection Types"
Related Topics
In this chapter:
In other chapters: