1
CREATE OR REPLACE TYPE pack.D_O IS OBJECT(
r number,
l number,
s_pack number(3),
s_pack_name varchar2(50),
n_uch number(5),
type_name varchar2(30),
date_att date,
cause_att number(2),
cause_att_name varchar2(250)
)

----------------------------------------------------------------------
CREATE OR REPLACE TYPE pack.D_T IS TABLE OF pack.D_O;

----------------------------------------------------------------------
CREATE OR REPLACE TYPE pack.d2_o IS OBJECT(
d NUMBER(5),
n VARCHAR2(75),
m VARCHAR2(75),
f number,
z pack.D_T
)

----------------------------------------------------------------------
select pack.d2_O(
manager,
name,
office,
regalias,
? -- how to fill "z" collection here?
)
from 
t1,t2
where 
.....
4

1 回答 1

4

您需要创建一个D_T, 具有 0 个或更多D_Os:

select pack.d2_O(
  manager,
  name,
  office,
  regalias,
  pack.D_T(
    pack.D_O(1,2,3,4,5,6,sysdate,8,9),
    pack.D_O(1,2,3,4,5,6,sysdate,8,9)
  )
)
from 
t1,t2

编辑

或用于CAST(COLLECT从子查询中填充 Z:

select pack.d2_O(
  manager,
  name,
  office,
  regalias,
  (
    select cast(collect(d_o(a,b,c,d,e,f,g,h,i)) as d_t)
    from t2
  )
)
from 
t1
于 2012-12-25T03:56:12.957 回答