How can I define a type in oracle11g that references a collection of that type?

后端 未结 2 579
渐次进展
渐次进展 2021-01-19 08:43

I want to do something like this

create type Item as object (
    id number,
    subitems table of ref Item
)

but oracle throws an exceptio

2条回答
  •  逝去的感伤
    2021-01-19 09:14

    Oracle will not compile your definition because the type Item hasn't been compiled yet. Why dont you give this a try:

    Compile this:

    CREATE OR REPLACE TYPE Item;
    
    CREATE OR REPLACE TYPE items_table IS TABLE OF REF item;
    

    and then try:

    CREATE OR REPLACE TYPE item AS OBJECT (
       id number,
       subitems items_table
    )
    

提交回复
热议问题