我创建的 customer_ty 对象有一个嵌套表,包括
CREATE TYPE deposit_ty as object(
depNo number,
depCategory ref depcategory_ty,
amount number,
period number
)
/
CREATE TYPE deposit_tbl as table of deposit_ty
/
CREATE TYPE customer_ty as object(
custId varchar2(4),
custName varchar2(10),
address address_ty,
dob date,
deposits deposit_tbl
)
/
我编写了一个代码来计算每个客户存入的总金额。这是我编写的代码;
alter type customer_ty
add member function totDeposits return number cascade
/
create or replace type body customer_ty as
member function totDeposits
return number is
total number;
BEGIN
select sum(d.amount) into total
from table(self.deposits) d;
group by self.custId,self.custName
return total;
END totDeposits;
END;
/
但是我收到一条警告说“使用编译错误创建的类型主体”。我能做些什么来摆脱这个?