0
我想查詢的輸出存儲在商店從子查詢分解爲批量輸出收集
WITH
with_b AS
(
Select A, B from Table1
)
SELECT *
FROM
(Select A, B from Table2) a, with_b b
WHERE a.A = b.A(+)
order by a.A;
到大量聚集。
我想查詢的輸出存儲在商店從子查詢分解爲批量輸出收集
WITH
with_b AS
(
Select A, B from Table1
)
SELECT *
FROM
(Select A, B from Table2) a, with_b b
WHERE a.A = b.A(+)
order by a.A;
到大量聚集。
您需要定義一個與最終查詢的投影相匹配的集合類型。在給出的代碼中,將來自table2
的兩列隨後是table1
的兩列。
事情是這樣的:
declare
type ab_rec is record (
a2 table2.a%type
, b2 table2.b%type
, a1 table1.a%type
, b1 table1.b%type
);
type ab_nt is table of ab_rec;
l_recs ab_nt;
begin
WITH
with_b AS
(
Select A, B from Table1
)
SELECT *
bulk collect into l_recs
FROM
(Select A, B from Table2) a, with_b b
WHERE a.A = b.A(+)
order by a.A;
.....
end;