2014-04-16 30 views
0

我创建了两个对象T_PERSONS,T_BUSINESS_PERSON,其中T_BUSINESS PERSON是子类型,T_PERSONS是超类型。我想用一个子类型对象代替一个超类型对象,但它不工作?

---创建T_PERSONS对象---

CREATE OR REPLACE 
TYPE T_PERSONS AS OBJECT 
(id integer, 
first_name varchar2(10), 
last_name varchar2(10), 
dob DATE, 
phone varchar2(12), 
address t_address, 
) NOT FINAL; 

---创建T_BUSINESS_PERSON对象---

CREATE TYPE t_business_person UNDER t_persons 
(title varchar2(20), 
company varchar2(20) 
); 

现在我创建了一个对象表object_customers

CREATE TABLE object_customers OF t_persons 

将数据插入object_customers

INSERT INTO object_customers VALUES 
(t_persons(1,'Jason','Bond','03-APR-1955','800-555-1211', 
    t_address('21 New Street','Anytown','CA','12345') 
)); 
在这种情况下

,数据已经插入正确

INSERT INTO object_customers VALUES 
(t_business_person(2,'Steve','Edwards','03-MAR-1955','800-555-1212', 
    t_address('1 Market Street','Anytown','VA','12345'),'Manager','XYZ Corp' 
)); 

现在,在这种情况下,即有错误

Error-attribute or element value is larger than specified in type. 

请帮助。

回答

0

第二插入方法仅当您创建表如下:

CREATE TABLE object_customers OF t_business_person; 

点击这里阅读更多关于NOTFINAL条款。

+0

我找到了解决方案... anywayz非常感谢。 – Nikhil

相关问题