title: Map-like object type in PL/SQL?
body: <p>I want to write a map-like object type in PL/SQL. What I mean is a key-value-pair list, where a value can be another key-value-pair list. Simple, or so I thought. Here are the two simplified</p>
  
  <pre><code>CREATE OR REPLACE TYPE TKey AS OBJECT
  (
      name varchar2(240),
      value_text varchar2(2000),
      value_map TMap
  )
  
  CREATE OR REPLACE TYPE TMap AS TABLE OF TKey
  </code></pre>
  
  <p>Maybe not so simple, because now I have a "Chicken or the egg"-problem. If I put TKey in first, he will complain that TMap is not defined. If I put in TMap first, he will complain that TKey is not defined. If I put TKey in and leave out the value_map line, then add the TMap type, then try to replace the TKey type, he will not allow it.</p>
  
  <p>Am I out of luck? Is such a construct not possible in PL/SQL?</p>
  
  <p>Thanks in advance</p>
  
  <p>Clarification:
  What I want is something, that can give me this:
  A map containing the keys a, b, and c. The value of a is the varchar "hello", the value of b is the varchar "world", and the value of c is another map, with the keys x and y, and the value of x being "what's" and the value of y being "up".</p>
  
  <p>This is what it would look like in Java:</p>
  
  <pre><code>Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;();
  map.set("a", "Hello");
  map.set("b", "World");
  Map&lt;String, Object&gt; child = new HashMap&lt;String, Object&gt;();
  child.set("x", "What's");
  child.set("y", "up");
  map.set("c", child);
  </code></pre>
  
  <p>Now I know that something like "object" as being able to store anything is not possible. What I need is an object that can store a list of objects being of the same type as this object. So basically, a tree, yeah.</p>