Map data structure in pl/sql for storing key value pair?
Is there anyway to create a map data structure in开发者_JAVA百科 pl/sql.
There is the PL/SQL associative array
DECLARE
TYPE salary_tab_t IS TABLE OF NUMBER INDEX BY VARCHAR2(30);
salary_tab salary_tab_t;
BEGIN
salary_tab('JONES') := 10000;
salary_tab('SMITH') := 12000;
salary_tab('BROWN') := 11000;
END;
You can loop through the elements like this:
l_idx := salary_tab.FIRST;
LOOP
EXIT WHEN l_idx IS NULL;
dbms_output.put_line (salary_tab(l_idx));
l_idx := salary_tab.NEXT(l_idx);
END LOOP;
精彩评论