This seems like a basic thing but i am not able to figure out. 
I have a PLSQL code block like below. It creates a simple sparse associative array and stores 5 elements at subscripts as -1,0,1,2,100. 

Printing ARRAY.LAST gives 100 and ARRAY.COUNT gives 5. In my while loop it prints all elements properly. 
But For loop going from ARRAY.FIRST to ARRAY.LAST prints only the elements at consecutive subscripts till 2, even though ARRAY.LAST gives 100

```
DECLARE
    TYPE assoc_array IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
    table1 assoc_array;
    i BINARY_INTEGER;
BEGIN
    table1(-1) := 100;
    table1(0) := 101;
    table1(1) := 102;
    table1(2) := 103;
    table1(100) := 104;

    i := table1.FIRST;

    dbms_output.put_line(table1.FIRST);
    dbms_output.put_line(table1.LAST);
    dbms_output.put_line(table1.COUNT);

    i := table1.first;

    while (i is not null)
    loop
        dbms_output.put_line( table1(i) );
        i := table1.next(i);
    end loop;

    dbms_output.put_line( '***');

    for i IN table1.FIRST .. table1.LAST
    loop
        dbms_output.put_line(table1(i) );
    end loop;
END;

```

Output looks like:

```
-1
100
5
100
101
102
103
104
***
100
101
102
103

```