2013-03-26 77 views
-1

如何將查詢中的數據添加到嵌套表中?將查詢中的數據添加到嵌套表中

我有我的嵌套表: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在我的嵌套表。 (我必須用一個嵌套表。)

回答

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; 
+0

感謝您的快速回答 – Snote 2013-03-26 16:10:46