Avoid traversing an associative array where no elements are initialized.
SQL> SQL> SET ECHO ON SQL> SET SERVEROUTPUT ON SIZE 1000000 SQL> SQL> DECLARE 2 3 4 TYPE charArrayType IS TABLE OF VARCHAR2(5 CHAR) INDEX BY BINARY_INTEGER; 5 6 7 charArray charArrayType; 8 9 BEGIN 10 11 IF charArray.COUNT <> 0 THEN 12 13 DBMS_OUTPUT.PUT_LINE(charArray(1)); 14 ELSE 15 16 DBMS_OUTPUT.PUT_LINE('empty.'); 17 18 END IF; 19 20 END; 21 / empty. PL/SQL procedure successfully completed. SQL> SQL>