Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> How to create mutually referencing types ?
Hi,
how can I create mutually referencing types ?
e.g., cities which belong to a country, and on the other hand, the country has a capital city:
CREATE OR REPLACE TYPE City_Type AS OBJECT
(Name VARCHAR2(35),
Country REF Country_Type,
Population NUMBER,
Coordinates GeoCoord);
/
CREATE OR REPLACE TYPE Country_Type AS OBJECT
(Name VARCHAR2(32),
Code VARCHAR2(4),
Capital REF City_Type;
Area NUMBER,
Population NUMBER);
/
??
First defining country_type without the capital attribut, then defining city_type, and then altering country_type by adding the reference to city does not work since my oracle complains that attributes acnnot be altered by ALTER TYPE:
ALTER TYPE Country_Type REPLACE AS OBJECT (Capital REF City_Type);
FEHLER in Zeile 1:
ORA-22319: Typattributinformationen in ALTER TYPE geaendert
[engl: Type attribute information changed in ALTER TYPE]
Wolfgang Received on Mon Dec 14 1998 - 06:54:19 CST