我有类似下面的simillar表和嵌套表格列:
create type hobbies_tab as table of varchar2(20);
create table Person(id Number,name varchar2(20),hobbies hobbies_tab) NESTED TABLE HOBBIES STORE AS TAB_HOBBIES;
insert into person values(2,'Sita',hobbies_tab('dancing','books'));
insert into person values(1,'Palash',hobbies_tab('Cricket','football'));
insert into person values(3,'sham',hobbies_tab('Cricket','dancing'));
我想选择那些有舞蹈的人。作为他们的爱好之一,我不知道在选择查询的where子句中写什么。
有人可以帮忙吗?
答案 0 :(得分:0)
select p.name
from person p, table(p.hobbies) h
where h.column_value = 'dancing';
或者,如果值可以是Dancing / DANCING / Riverdancing,则where子句可以是:
where lower(h.column_value) like '%dancing%'