1
我有兩個對象關係表: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);
謝謝
我編輯了您的問題以標準化對象名稱。 – APC
謝謝,這是更好 –