我创建了 2 种类型和一个包含这些类型的表:
create or replace type a_t as varray(5) of int
create or replace type b_t as varray(5) of int
create table test(
a a_t,
b b_t
)
insert into test Values (
a_t(1,2,3),
b_t(4,5,6)
)
我现在想要的是选择结果
a_t b_t
------|-----
1 | 4
2 | 5
3 | 6
在 1 列上使用 table 运算符会导致:
select a.* from test t, table(t.a_t) a
a_t
------
1
2
3
但现在我不知道如何获得第二行并以正确的顺序将它们配对
尝试这样的事情。
WITH tab_a
AS (SELECT ROWNUM rn,
a.*
FROM test t,
TABLE ( t.a ) a),
tab_b
AS (SELECT ROWNUM rn,
b.*
FROM test t,
TABLE ( t.b ) b)
SELECT a.column_value a_t,
b.column_value b_t
FROM tab_a a
FULL OUTER JOIN tab_b b
ON a.rn = b.rn;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句