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

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 indexth 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

Related Topics

In this chapter:

In other chapters: