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: How to create mutually referencing types ?

Re: How to create mutually referencing types ?

From: Erika Grondzakova <Erika.Grondzakova_at_cern.ch>
Date: Mon, 14 Dec 1998 16:48:08 +0100
Message-ID: <36753338.BE25BBEE@cern.ch>


Hi,

I would like to ask few questions (as I don't have Oracle 8 to try it by myself...:-)

Is it possible to create a table with 2 nested tables ? Something like this ?

create type countries_NT as table of Country_type; create type capitals_NT as table of City_type;

create table state
( countries Country_type,
  capitals City_type)
NESTED TABLE countries STORE AS countries_NT, NESTED TABLE capitals STORE AS capitals_NT;

If so, I'm curious how could you insert values if you have a table with 2 nested tables - columns which are muttually referencing...

insert into state values
( countries_NT(Country_type('name_of_state','code',???,10,10),   capitals_NT (City_type('name_of_city',???,5));

What you should put instead of ??? in the insert statement?

Thank you,

Best regards,

Erika

Thomas Kyte wrote:
>
> A copy of this was sent to may_at_informatik.uni-freiburg.de (Wolfgang May)
> (if that email address didn't require changing)
> On 14 Dec 1998 12:54:19 GMT, you wrote:
>
> You can do this by forward declaring the type as follows:
>
> create type Country_type
> /
>
> CREATE OR REPLACE TYPE City_Type AS OBJECT
> (Name VARCHAR2(35),
> Country REF Country_Type,
> Population NUMBER );
> /
>
> CREATE OR REPLACE TYPE Country_Type AS OBJECT
> (Name VARCHAR2(32),
> Code VARCHAR2(4),
> Capital REF City_Type,
> Area NUMBER,
> Population NUMBER);
> /
>
Received on Mon Dec 14 1998 - 09:48:08 CST

Original text of this message

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