如何将查询中的数据添加到嵌套表中?
我有我的嵌套表:TYPE TABLE_DATA IS TABLE OF NUMBER;
和我的查询SELECT num FROM table_one JOIN table_two t2 ON table_one.num = t2.num WHERE f1.id = pid;
我想在嵌套表中拥有每个行存储的num
。
(我必须使用嵌套表。)
答案 0 :(得分:1)
使用BULK COLLECT
:
DECLARE
TYPE table_data IS TABLE OF NUMBER;
l_data table_data;
BEGIN
SELECT num
BULK COLLECT INTO l_data
FROM table_one
JOIN table_two t2 ON table_one.num = t2.num
WHERE f1.id = pid;
END;