当前位置: 代码迷 >> Oracle管理 >> oracle 10g, 自定义类型报错求指教解决方案
  详细解决方案

oracle 10g, 自定义类型报错求指教解决方案

热度:48   发布时间:2016-04-24 05:41:27.0
oracle 10g, 自定义类型报错求指教
SQL:
CREATE OR REPLACE TYPE Type_Address AS OBJECT(Street CHAR(50),State CHAR(20),City CHAR(20),Zip CHAR(10) ); ->ok!
create table TT( ID INTEGER, ADDRESS Type_Address) ; ->OK!
INSERT INTO TT VALUES(1,Type_Address('1316 WEST 35TH ','CA','LOS ANGELES','90007')); -> ok!

Select ID from TT 正常返回值 

Select * from TT / Select ADDRESS from TT 报错:错误提示为:

ORA-00932: 数据类型不一致: 应为 NUMBER, 但却获得 USER.TYPE_ADDRESS

求指教!!!

------解决方案--------------------
SQL code
[TEST2@orcl#22-2月 -11] SQL>select * from tt;        ID----------ADDRESS(STREET, STATE, CITY, ZIP)--------------------------------------------         1TYPE_ADDRESS('1316 WEST 35TH                                    ', 'CA        ', 'LOS ANGELES         ', '90007     ')[TEST2@orcl#22-2月 -11] SQL>select address from tt;ADDRESS(STREET, STATE, CITY, ZIP)--------------------------------------------TYPE_ADDRESS('1316 WEST 35TH                                    ', 'CA        ', 'LOS ANGELES         ', '90007     ')
  相关解决方案