如何从嵌套表中获取表[PL / SQL]

时间:2013-11-01 20:31:36

标签: sql oracle plsql nested-table

我想从嵌套表中获取表。

创建表格类型:

CREATE OR REPLACE TYPE Name_list_t AS TABLE OF VARCHAR2(50)

更改我的表添加列嵌套表:

ALTER TABLE MOVIES ADD Movi_name_list Name_list_t NESTED TABLE Movi_name_list STORE AS Movi_name_list

将表添加到嵌套表:

Declare
extractNames Name_list_t;
Begin
(...) some code...
update movies set movi_name_list=extractNames where movi_id=id_movie;
End;

插入表工作很棒。最后,我想从嵌套表中获取表,我不知道如何。我尝试了两种方法但没有成功:

select movi_name_list into extractNames from movies where movi_id=1; 
extractNames := select movi_name_list from movies;

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

@Egor Skriptunoff工作中选择!

解决方案:

select column_value bulk collect into extractNames from table(select movi_name_list from movies where movi_id=1)

我的选择投射不正确,我想。