Associate array: varchar2 to number map
SQL> DECLARE
2 TYPE varcharType IS TABLE OF NUMBER(17,2) INDEX BY VARCHAR2(12);
3 city varcharType;
4 sales_figure NUMBER;
5 first VARCHAR2(12);
6 last VARCHAR2(12);
7 BEGIN
8 city('West') := 2.3;
9 city('East') := 1.9;
10 city('MidWest') := 3.4;
11 sales_figure := city('East');
12 first := city.FIRST;
13 last := city.LAST;
14 sales_figure := city(city.LAST);
15 city('West') := 1.55;
16 DBMS_OUTPUT.PUT_LINE (first);
17 DBMS_OUTPUT.PUT_LINE (last);
18 DBMS_OUTPUT.PUT_LINE (sales_figure);
19 END;
20 /
East
West
2.3
PL/SQL procedure successfully completed.
SQL>
Related examples in the same category