13.10 Collection Method Invocation
A collection method is a PL/SQL subprogram that either returns information about a collection or operates on a collection.
Topics
Syntax
collection_method_call ::=
Semantics
collection_method_call
collection
Name of the collection whose method you are invoking.
COUNT
Function that returns the number of elements in the collection, explained in "COUNT Collection Method".
DELETE
Procedure that deletes elements from the collection, explained in "DELETE Collection Method".
Restriction on DELETE
If collection
is a varray, you cannot specify indexes with DELETE
.
index
Numeric expression whose data type either is PLS_INTEGER
or can be implicitly converted to PLS_INTEGER
(for information about the latter, see "s").
EXISTS
Function that returns TRUE
if the index
th element of the collection exists and FALSE
otherwise, explained in "EXISTS Collection Method".
EXTEND
Procedure that adds elements to the end of the collection, explained in "EXTEND Collection Method".
Restriction on EXTEND
You cannot use EXTEND
if collection
is an associative array.
FIRST
Function that returns the first index in the collection, explained in "FIRST and LAST Collection Methods".
LAST
Function that returns the last index in the collection, explained in "FIRST and LAST Collection Methods".
LIMIT
Function that returns the maximum number of elements that the collection can have. If the collection has no maximum size, then LIMIT
returns NULL
. For an example, see "LIMIT Collection Method".
NEXT
Function that returns the index 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
Function that returns the index 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
Procedure that deletes elements from the end of a collection, explained in "TRIM Collection Method".
Restriction on TRIM
You cannot use TRIM
if collection
is an associative array.
number
Number of elements to delete from the end of a collection. Default: one.
Examples
-
Example 5-19, "DELETE Method with Nested Table"
-
Example 5-20, "DELETE Method with Associative Array Indexed by String"
-
Example 5-21, "TRIM Method with Nested Table"
-
Example 5-22, "EXTEND Method with Nested Table"
-
Example 5-23, "EXISTS Method with Nested Table"
-
Example 5-24, "FIRST and LAST Values for Associative Array Indexed by PLS_INTEGER"
-
Example 5-25, "FIRST and LAST Values for Associative Array Indexed by String"
-
Example 5-26, "Printing Varray with FIRST and LAST in FOR LOOP"
-
Example 5-27, "Printing Nested Table with FIRST and LAST in FOR LOOP"
-
Example 5-28, "COUNT and LAST Values for Varray"
-
Example 5-29, "COUNT and LAST Values for Nested Table"
-
Example 5-30, "LIMIT and COUNT Values for Different Collection Types"
-
Example 5-31, "PRIOR and NEXT Methods"
-
Example 5-32, "Printing Elements of Sparse Nested Table"
Related Topics
In this chapter:
In other chapters: