Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: OO pl/sql nested collection limitation?

Re: OO pl/sql nested collection limitation?

From: Rene Nyffenegger <rene.nyffenegger_at_gmx.ch>
Date: 27 Feb 2003 17:12:57 GMT
Message-ID: <b3lguo$1nkska$1@ID-82536.news.dfncis.de>

I don't know how it works (or doesn't, respectively), but the following snippet works fine on Oracle 9.2:

create or replace type A as object (

   x_ number,
   y_ varchar2(10)
);
/

create or replace type AList as table of A; /

create or replace type B as object (
  l_ char(2),
  a_ AList
);
/

declare

  b1 B;
  b2 B;
  b3 B;

begin
  b1 := B('fr',AList(A('1','un'  ),A('2','deux')));
  b2 := B('de',AList(A('1','eins'),A('2','zwei')));
  b3 := B('en',AList(A('1','one' ),A('2','two' )));

  dbms_output.put_line(b2.a_(2).y_);
end;
/

hth
Rene Nyffenegger

> I am attempting to build a pl/sql app using the object-oriented
> feautres in Oracle 8i and I have not been able to define a three-tier
> nested relationship containing collections. I would like to know if it
> is even possible. Let me explain.
> If I define type A as an object :
> create or replace type A as object (
> scalar_data_fields
> -- add methods here down
> );
> Then create a collection of A as AList:
> create or replace type AList as
> table of A; -- also used varray();
> Now I can create object B conatining an AList field:
> create or replace type B as object (
> scalar_data_fields,
> myACollection AList
> -- add methods here down
> );
> However at this point when I want to create another type C which
> contains
> a collection of B (via a BList type):
> create or replace type BList as
> table of B; -- also used varray();
>
> No dice.
> "PLS-00534: A Table type may not contain a nested table type or
> VARRAY."
>
> Can I assume that this is not supported or am I missing something.
> All code
> examples from oracle only describe the two-level scenarios. This may
> be an oversight or just tricky marketing because I don't know of many
> complex apps
> that can be built relying on such simple structures.
> If anyone can help out either by letting me know that it is not
> supported
> or by pointing me in the direction of a solution, it would be a big
> help so I can start down the procedural road to solve my problem.
> Thanks in advance.
>
> ~matt

-- 
  no sig today
Received on Thu Feb 27 2003 - 11:12:57 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US