For an associative array indexed by string, the first and last elements are those with the lowest and highest key values, respectively.
Key values are in sorted order.
The following code shows the values of FIRST and LAST for an associative array indexed by string.
SQL> SQL> DECLARE-- www .j a v a 2 s . c om 2 TYPE MyMap IS TABLE OF INTEGER INDEX BY VARCHAR2(10); 3 MyMapVariable MyMap; 4 5 PROCEDURE print_first_and_last IS 6 BEGIN 7 DBMS_OUTPUT.PUT_LINE('FIRST = ' || MyMapVariable.FIRST); 8 DBMS_OUTPUT.PUT_LINE('LAST = ' || MyMapVariable.LAST); 9 END print_first_and_last; 10 11 BEGIN 12 MyMapVariable('Z') := 26; 13 MyMapVariable('A') := 1; 14 MyMapVariable('K') := 11; 15 MyMapVariable('R') := 18; 16 DBMS_OUTPUT.PUT_LINE('Before deletions:'); 17 print_first_and_last; 18 19 MyMapVariable.DELETE('A'); 20 MyMapVariable.DELETE('Z'); 21 22 DBMS_OUTPUT.PUT_LINE('After deletions:'); 23 print_first_and_last; 24 END; 25 / Before deletions: FIRST = A LAST = Z After deletions: FIRST = K LAST = R PL/SQL procedure successfully completed. SQL>