Oracle_Nested_Table3.htm
An Example of Associative Array : Index By
SET SERVEROUTPUT ON;
CREATE OR REPLACE PROCEDURE m5_emp_sal1 AS
TYPE m5_emp_sal1 IS TABLE OF NUMBER INDEX BY VARCHAR2(20);
LLC_List_Tax m5_emp_sal1;
name VARCHAR2(20);
BEGIN
-- adding elements to the table
LLC_List_Tax('Pioneer Co') :=150000;
LLC_List_Tax('Aaron Inc') := 77500;
LLC_List_Tax('Shalimer Co') := 95000;
LLC_List_Tax('Mom Pop Inc') := 35000;

-- printing the table
name := LLC_List_Tax.FIRST;
WHILE name IS NOT null LOOP
dbms_output.put_line
('Salary of ' || name || ' is ' || TO_CHAR(LLC_List_Tax(name)));
name := LLC_List_Tax.NEXT(name);
END LOOP;
END m5_emp_sal1;
/

CALL m5_emp_sal1();