DECLARE
TYPE numlist IS TABLE OF NUMBER;
n NUMLIST := Numlist(2,4,6,8); -- Collection starts with 4 elements.
BEGIN
dbms_output.Put_line('There are '
||n.COUNT
||' elements in N.');
n.EXTEND(3); -- Add 3 new elements at the end.
dbms_output.Put_line('Now there are '
||n.COUNT
||' elements in N.');
n := Numlist(86,99); -- Assign a completely new value with 2 elements.
dbms_output.Put_line('Now there are '
||n.COUNT
||' elements in N.');
n.TRIM(2); -- Remove the last 2 elements, leaving none.
dbms_output.Put_line('Now there are '
||n.COUNT
||' elements in N.');
END;
/
Counting Collection Elements With COUNT
0 comments:
Post a Comment