嵌套 table 数据检索
Nested table data retrieval
我有类似 table 的嵌套 table 列:
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'));
想select有'dancing'爱好的人,不知道select查询的where子句写什么
有人可以帮忙吗?
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%'
我有类似 table 的嵌套 table 列:
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'));
想select有'dancing'爱好的人,不知道select查询的where子句写什么
有人可以帮忙吗?
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%'