December 2010
Intermediate to advanced
451 pages
11h 16m
English
You have a collection, and you need to determine the total number of elements in the collection.
Invoke the built-in COUNT method on the collection. For example, the following code creates two collections: a varying array and an INDEX BY array. The code then invokes the COUNT method on both collections, doing so before and after adding some records to each.
DECLARE
TYPE vtype IS VARRAY(3) OF DATE;
TYPE ctype IS TABLE OF DATE INDEX BY BINARY_INTEGER;
vdates vtype := vtype (sysdate);
cdates ctype;
BEGIN
DBMS_OUTPUT.PUT_LINE ('vdates size is: ' || vdates.COUNT);
DBMS_OUTPUT.PUT_LINE ('cdates size is: ' || cdates.COUNT);
FOR i IN 1..3 LOOP cdates(i) := SYSDATE ...Read now
Unlock full access