【发布时间】:2012-05-17 22:31:47
【问题描述】:
是否可以直接选择分层用户类型?
想象一下这样的表结构:
PARENT
------
ID
NAME
CHILD
-----
ID
PARENT_ID
NAME
另外,我有这样的用户类型:
create or replace type child_item as object
(
ID NUMBER(10),
NAME VARCHAR(255)
);
create or replace type children_table as table of child_item;
create or replace type parent_item as object
(
ID NUMBER(10),
NAME VARCHAR(255),
CHILDREN CHILDREN_TABLE
);
create or replace type parent_table as table of parent_item;
还有这样的声明:
select * from parent p inner join child c on p.id = c.parent_id;
现在,我希望该语句的结果位于 parent_table 类型的对象中。如果不使用复杂的FOR 循环,这是否可能?
【问题讨论】:
标签: sql oracle plsql user-defined-types