甲骨文版本: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":无效标识符
如何解决错误?
谢谢
发布于 2013-10-12 11:06:10
我认为您需要用表对列进行限定,这样它就不会尝试将person解释为表名;它需要是别名(不完全确定为什么):
select c.person.FullName from customer c;SQL Fiddle。
https://stackoverflow.com/questions/19332936
复制相似问题