Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> How to insert when a table has an object type
I am in the proces of redesigning some tables, as i have upgraded from
personal oracle 7 to personal oracle 8i.
I have constructet an object type Address_type, which is one of the columns
in a table named DestTable.
The object type is created as follows:
CREATE OR REPLACE TYPE pub.address_type
AS OBJECT
(Street1 varchar2(50),
Street2 varchar2(50),
ZipCode varchar2(10));
The table is created as follows:
CREATE TABLE pub.DestTable
(id INTEGER PRIMARY KEY,
LastName varchar2(30),
FirstName varchar2(25),
Address pub.address_type);
Inserting a single row is ok as i use the following syntax: Insert into DestTable(1, 'Ellison', 'Lawrence', pub.address_type( '500 Oracle Parkway', 'Box 659510', '95045'));
When i try to insert values into the table by selecting from another table i cannot do it and cannot figure out what is wrong
I have used the following syntax:
Insert into DestTable
(id, name, pub.address_type(Street1, Street2, ZipCode)) select id, lastname, firstname, street1, street2, ZipCode from SourceTable;
I have also tried the following syntax:
Insert into DestTable
(id, name, pub.address_type(Address.Street1, Address.Street2,
Address.ZipCode))
select id, lastname, firstname, street1, street2, ZipCode from SourceTable;
What is wrong here ? Received on Sun Apr 29 2001 - 14:56:28 CDT