In the Object-Relational Developer's Guide I found reference to subordinate/embedded types that are different - department includes address, for instance. This document also includes a section of resolving circular references, but again, between objects of different types. I am looking for the object to reference itself.

create or replace type a_obj is object (myself varchar2(10), parent      number, children number);
/
create or replace type c_obj is table of ref a_obj;
/
create or replace type a_obj is object (myself varchar2(10), parent a_obj, children c_obj);
/
Type A_OBJ compiled


Type C_OBJ compiled


Error starting at line : 12 in command -
create or replace type a_obj is object (myself varchar2(10), parent a_obj, children c_obj);
Error report -
ORA-02303: cannot drop or replace a type with type or table dependents
02303. 00000 -  "cannot drop or replace a type with type or table dependents"
*Cause:    An attempt was made to drop or replace a type that has
           type or table dependents.
*Action:   For DROP TYPE, drop all type(s) and table(s) depending on the
           type and then retry the operation, or use the FORCE option.
           For CREATE TYPE, drop all type(s) and table(s) depending on the
           type and then retry the operation, or drop all table(s) depending
           on the type and retry with the FORCE option.
1

There are 1 best solutions below

0
On

Forward declare the type and set the parent to be a REF type:

create type a_obj;
/

create type c_obj is table of ref a_obj;
/

create or replace type a_obj is object (
  myself   varchar2(10),
  parent   REF a_obj,
  children c_obj
);
/

db<>fiddle here