INDICES OF: The INDICES OF clause allows us to load non-contiguous (sparse) arrays by telling Oracle to use just the elements that are populated. Remember in versions prior to 10g that arrays had to be dense and we would use iterators such as [array.FIRST .. array.LAST] or [1 .. array.COUNT] to address them (these are still syntactically valid of course). The INDICES OF clause is simple to use as seen in the example below.
SQL> DECLARE
2
3 TYPE aat_rec IS TABLE OF tgt%ROWTYPE
4 INDEX BY PLS_INTEGER;
5 aa_recs aat_rec;
6
7 BEGIN
8
9 /* Load a sparse array... */
10 SELECT object_id, object_name BULK COLLECT INTO aa_recs
11 FROM all_objects
12 WHERE ROWNUM <= 10;
13
14 aa_recs.DELETE(2);
15 aa_recs.DELETE(4);
16 aa_recs.DELETE(6);