and i now want to use the definded type in an object definition:
create or replace package my_package is type t_objectlist is table of my_ObjectClass index by binary_integer; end;
i get an error telling me, the identifier my_package.t_objectlist is not defined.
create or replace type my_Object as Object ( myMember my_package.t_objectlist )
MiBoe wrote:Why define an associative array when the name of the name-value pair is simply a sequential index number?
type t_objectlist is table of my_ObjectClass index by binary_integer;
However, this is (almost) never used as above - instead values are sequentially assigned and the name is simply a sequential number. In this case there is absolutely no need for making this array construct an associative array. A plain vanilla array is what should be used.
SQL> declare 2 type t_objectlist is table of varchar2(100) index by binary_integer; 3 4 objList t_objectlist; 5 begin 6 objList(100) := 'object 1'; --// 1st item in the array - index name is 100 (not 1) 7 objList(1) := 'object 2'; 8 objList(0) := 'object 3'; --// last item in the array - index name is 0 9 end; 10 / PL/SQL procedure successfully completed.
The collection class for this object can implement methods to access a value via name, check for the existence of a name, provide a list of sorted names, and so on.
create or replace type TNameValue as object( name varchar2(100), value varchar2(4000) );