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

后端 未结 2 580
渐次进展
渐次进展 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:15

    That would be nice wouldn't it! You could try this:

    create type item_ids_t is table of number;
    
    create type Item as object (
       id number,
       subitems item_ids_t);
    

    Which means that subitems is just a list of ids, which would then be used to look up a table indexed by id.

提交回复
热议问题