Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to insert when a table has an object type

Re: How to insert when a table has an object type

From: Yang <yg.yang_at_wanadoo.fr>
Date: Mon, 30 Apr 2001 21:19:40 +0200
Message-ID: <9ckds9$mlb$1@wanadoo.fr>

try :

Insert into DestTable

          (id, lastname, firstname, ....) select id, lastname, firstname, .... from SourceTable;

Magnus S. Petersen wrote in message <3aec682d$1_at_news.olivant.fo>...
>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 Mon Apr 30 2001 - 14:19:40 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US