Hash Map Using Plsql

Hi Expert,

Is there a way in Oracle pl/sql that I can create a data-structure like java Hash-map which can have a record type as value and String as index.

Thanks in Advance
MIHIR KAROracle DB beginnerAsked:
Who is Participating?
 
sdstuberConnect With a Mentor Commented:
yes, an associative array with a varchar2 type as the indexing value

an example might look something like this...

DECLARE
    TYPE yourrecord IS RECORD
    (
        n    NUMBER,
        d    DATE
    );

    TYPE hashmap IS TABLE OF yourrecord
        INDEX BY VARCHAR2(50);

    yourmap   hashmap;
BEGIN
    yourmap('abc').n := 1;
    yourmap('abc').d := SYSDATE;

    yourmap('xyz').n := 2;
    yourmap('xyz').d := SYSDATE - 3;
END;

Open in new window

0
 
MIHIR KAROracle DB  beginnerAuthor Commented:
Thank you Very Much !!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.