Saturday, March 30, 2013

Comparison of PL/SQL COLLECTIONS - II

NAME VARRAY NESTED TABLE ASSOCIATIVE ARRAY
DECLARATION TYPE VarTab IS VARRAY(10) of NUMBER; TYPE VarTab IS TABLE OF NUMBER; TYPE xx_AsscArr IS TABLE OF VARCHAR2(20)
INDEX BY PLS_INTEGER;
INITIALIZATION v1 := VarTab(); v1 := VarTab(); NA
ASSIGNMENT v1.extend();
v1(1):=1001
v1.extend();
v1(1):=1001
v1(1):='Vizag';
LIMIT
Gives Max length of collection
v1.LIMIT NA as it is unbounded NA as it is unbounded
EXTENDS
Allocates one NULL element
to a collection
v1.EXTENDS v1.EXTENDS NA
EXTENDS(n)
Allocates n NULL elements
to a collection
v1.EXTENDS(5) v1.EXTENDS(5) NA
EXTENDS(n,i)
Allocates n elements
with valueof element at index i collection
v1.EXTENDS(4,1) v1.EXTENDS(4,1) NA
EXISTS(n)
Returns TRUE if element exists
at Index n else returns FALSE
v1.EXISTS(-100) v1.EXISTS(-100) v1.EXISTS(-100)
COUNT
Returns total no of elements
in a collection
v1.COUNT v1.COUNT v1.COUNT
FIRST
Returns the index of the
first element in the collection
v1.FIRST v1.FIRST v1.FIRST
LAST
Returns the index of the
last element in the collection
v1.LAST v1.LAST v1.LAST
PRIOR(n)
Returns the index of the element prior to the
current element
v1.PRIOR(n) v1.PRIOR(n) v1.PRIOR(n)
NEXT(n)
Returns the index of the element next to the
current element
v1.NEXT(n) v1.NEXT(n) v1.NEXT(n)

No comments:

Post a Comment