【发布时间】:2017-08-13 13:00:26
【问题描述】:
我有一个表 customer_table,其中包含对 account_table 行的引用列表(嵌套表)。
这是我的声明:
客户类型:
CREATE TYPE customer as object(
custid integer,
infos ref type_person,
accounts accounts_list
);
accounts_list 类型:
CREATE TYPE accounts_list AS table of ref account;
表:
CREATE TABLE customer_table OF customer(
custid primary key,
constraint c_inf check(infos is not null),
constraint c_acc check(accounts is not null)
)
NESTED TABLE accounts STORE AS accounts_refs_nt_table;
所以我想在创建客户时在我的嵌套表中插入多个引用,因为可以共享一个帐户。
我不知道该怎么做。
我试过了:
INSERT INTO customer_table(
SELECT 0,
ref(p),
accounts_list(
SELECT ref(a) FROM account_table a WHERE a.accid = 0
UNION ALL
SELECT ref(a) FROM account_table a WHERE a.accid = 1
)
FROM DUAL
FROM person_table p
WHERE p.personid = 0
);
没有成功。
谢谢
【问题讨论】:
标签: sql oracle reference nested-table object-oriented-database