I have two object-relational tables: person_table
and account_table
, built out of objects person
and account
.
An account row has a nested table for all the people sharing this account, its type is 'customer_list'.
create type person as object(
id integer,
name varchar2,
phone varchar2
);
create type customer_list as table of ref person;
create type account as object(
accid integer,
owned_by customer_list,
balance Integer
);
create table account_table of account;
create table person_table of person;
I want to select all the accounts owned by a specific person, given the person's id. How do I browse through all the nested tables of account, what is the query ? I tried unsuccessful queries.
For example
select a.*
from account_table a
where table(a.owned_by) = (select ref(p) from person_table p where p.id=id_given);
Thank you