Citation :
SQL> create type manuf_t is table of number;
2 /
Type created.
SQL> create table products
2 ( product_id number primary key
3 , product_name varchar2(30)
4 , manufacturers manuf_t
5 ) nested table manufacturers store as product_manufacturers;
Table created.
SQL> insert into products values (1,'puppet',manuf_t(1,3,5));
1 row created.
SQL> insert into products values (2,'balloon',manuf_t(2));
1 row created.
SQL> insert into products values (3,'teddy bear',manuf_t(1,2,4));
1 row created.
SQL> insert into products values (4,'puzzle',manuf_t(3,6));
1 row created.
SQL> select product_name
2 from products p, table(p.manufacturers) pm
3 group by p.product_name
4 having count(*) =
5 ( select max(cnt) from
6 ( select count(*) cnt
7 from products p, table(p.manufacturers) pm
8 group by p.product_id
9 )
10* );
PRODUCT_NAME
------------------------------
puppet
teddy bear
|