Download PL/SQL User's Guide and Reference

Transcript
Collection Methods
Collection Methods
A collection method is a built-in function or procedure that operates on collections and
is called using dot notation. You can use the methods EXISTS, COUNT, LIMIT, FIRST,
LAST, PRIOR, NEXT, EXTEND, TRIM, and DELETE to manage collections whose size is
unknown or varies.
EXISTS, COUNT, LIMIT, FIRST, LAST, PRIOR, and NEXT are functions that check the
properties of a collection or individual collection elements. EXTEND, TRIM, and
DELETE are procedures that modify a collection.
EXISTS, PRIOR, NEXT, TRIM, EXTEND, and DELETE take integer parameters. EXISTS,
PRIOR, NEXT, and DELETE can also take VARCHAR2 parameters for associative arrays
with string keys. EXTEND and TRIM cannot be used with index-by tables.
For more information, see "Using Collection Methods" on page 5-23.
Syntax
collection_method_call
COUNT
,
(
index
index
)
DELETE
EXISTS
(
index
)
,
(
number
index
)
index
)
EXTEND
collection_name
.
FIRST
LAST
LIMIT
NEXT
PRIOR
(
(
index
(
)
number
)
TRIM
Keyword and Parameter Description
collection_name
An associative array, nested table, or varray previously declared within the current
scope.
COUNT
Returns the number of elements that a collection currently contains, which is useful
because the current size of a collection is not always known. You can use COUNT
wherever an integer expression is allowed.
PL/SQL Language Elements
13-17