Oracle版本:Oracle Database 11g Express Edition Release 11.2.0.2.0
- 生产
create type address_ty as object
(street varchar2(50),
city varchar2(50),
state varchar2(25),
postalcode integer);
create or replace type person_ty as object
(FullName varchar2(50),
BirthDate date,
Address address_ty,
member function CalcAge (BirthDate in DATE) return number,
PRAGMA RESTRICT_REFERENCES (CALCAGE, WNDS));
create or replace type body person_ty as
member function CalcAge (BirthDate DATE) return number is
begin
return round(sysdate - BirthDate);
end;
end;
/
create table customer (customerId integer,
Person person_ty);
describe customer;
select attr_name, length, attr_type_name from user_type_attrs where type_name = 'PERSON_TY';
select attr_name, length, attr_type_name from user_type_attrs where type_name = 'ADDRESS_TY';
insert into customer values (1, person_ty('ABC', '01-JAN-95', address_ty('MG Road', 'Bangalore', 'KA', 560001)));
select person.FullName from customer;
上述语句显示错误 -
ORA-00904:“PERSON”。“FULLNAME”:标识符无效
如何解决错误?
由于
答案 0 :(得分:0)
我认为您需要使用表限定列,因此它不会尝试将person
解释为表名;它需要是一个别名(不完全确定原因):
select c.person.FullName from customer c;