【发布时间】:2017-08-10 00:09:36
【问题描述】:
我有两个对象关系表:person_table 和 account_table,由对象 person 和 account 构建而成。
一个帐户行有一个嵌套表,用于共享此帐户的所有人员,其类型为“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;
在给定此人的 ID 的情况下,我想选择该人拥有的所有帐户。如何浏览帐户的所有嵌套表,查询是什么?我尝试了不成功的查询。
例如
select a.*
from account_table a
where table(a.owned_by) = (select ref(p) from person_table p where p.id=id_given);
谢谢
【问题讨论】:
-
我编辑了您的问题以标准化对象名称。
标签: sql oracle user-defined-types nested-table object-relational-model