Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Help on Insert with Select
The table into which you insert contains the column that is an object type, therefore the column that is to be inserted has to be an object type.
The table from which you select contains no object type, so the multiple columns you select have to be converted into an object before they can be inserted.
Looking at it another way -
your target table has only 4 columns
your source (table) has 12 columns
You have to make your select statement appear
to have only 4 columns, hence you collapse
9 of them into a single object_type column at
select time.
-- Jonathan Lewis http://www.jlcomp.demon.co.uk Host to The Co-Operative Oracle Users' FAQ http://www.jlcomp.demon.co.uk/faq/ind_faq.html Author of: Practical Oracle 8i: Building Efficient Databases Screen saver or Life saver: http://www.ud.com Use spare CPU to assist in cancer research. Magnus S. Petersen wrote in message <3b96867d$1_at_news.olivant.fo>...Received on Wed Sep 05 2001 - 15:24:53 CDT
>You will have noticed that it is only the table in which I shall insert
that
>has an object type. Therefore i cannot understand why i should use the
>constructor in the select table.
>Is there something I fundamentally have misunderstood ?
>Regard
>Magnus S Petersen
>
>"Jonathan Lewis" <jonathan_at_jlcomp.demon.co.uk> skrev i en meddelelse
>news:999671820.6508.1.nnrp-13.9e984b29_at_news.demon.co.uk...
>>
>> Try changing the position of the type-constructor:
>>
>> INSERT INTO advfirma_obj
>> (Id, Navn,adresse_ty,Retskreds)
>> SELECT
>> Id, Navn,
>> addresse_ty(Adresse1, Adresse2, Postnr, NULL, Telefon,
>> NULL, Telefax, Email,Hjemmeside
>> ), Retskreds
>> FROM Advfirma;
>>