日期:2014-05-17  浏览次数:20852 次

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)
--------------------------------------------
         1
TYPE_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     ')