Two dimensional array in oracle

How do I implement a two dimensional array in PL/SQL.
Please note that I do not know the upper bound and I dont want to use varray for the same reason.
Is there anyway I can define a record type, add elements to the record and loop the collection when required?
All I want to implement in PL/SQL, and all TYPE OBJECTS should be declared in PL/SQL block only.
 I will store this kind of data into array.  I will populate the year (1st dimension) and the units (2nd dimension) based on the calculated parameters
2004,1
2004,2
2004,3
2005,1
2005,2
2005,3
2005,4

Example to accomplish above will be real good.
&.
&.
LVL 14
ajexpertAsked:
Who is Participating?
 
mohammadzahidConnect With a Mentor Commented:
Please goto this url for answer to your question.

http://www.oracle.com/technology/oramag/oracle/06-jan/o16plsql.html

Let me know if you have any questions.

0
 
ajexpertAuthor Commented:
Nope,
I have already seen this URL before posting question.
The way its described is in bit convoluted manner.  The I assume there is simpler way of doing this.
 
0
 
sdstuberConnect With a Mentor Commented:
an array of arrays is the closest thing you're going to get in pl/sql to a 2-dimensional array.

However, for your data,  it looks like a one dimensional array of a 2 field record type might be sufficient


 TYPE aj_rec IS RECORD(
       year   INTEGER,
       units  INTEGER
    );

TYPE aj_tab IS TABLE OF aj_rec INDEX BY BINARY_INTEGER;
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.