Is it possible to create Oracle associative array type outside of a package/procedure?

The answer is no, you cannot do what you're trying to do, any more than you can create a type to add a BOOLEAN typed variable to an object. The items in an object must contain Oracle types, not PL/SQL types. A bit clunky alternative could be:

CREATE TYPE t_aa AS VARRAY(10) OF VARCHAR2(10);

CREATE OR REPLACE TYPE t_ua AS OBJECT (ID NUMBER(15)
                                     , MEMBER PROCEDURE initialize(p_aa t_aa)
                                     , MEMBER PROCEDURE initialize(p_aa_i t_aa))
                               NOT INSTANTIABLE NOT FINAL;

Store your associated pairs of variables in the two VARRAYs. You will have to know the largest possible size of your arrays.

Tags:

Oracle

Plsql