Re: INSERT INTO TABLE that has mismatched structure.

From: Ed prochak <ed.prochak_at_alltel.com>
Date: 30 May 2002 10:20:27 -0700
Message-ID: <e51b160.0205300920.6756f964_at_posting.google.com>


factor_at_mail.ru (Kevin) wrote in message news:<eb7b37e9.0205291959.78779f1e_at_posting.google.com>...
> Hello!
>
> I want to append records from one table to another, that contain more
> fields.
>
> I try to make this:
> INSERT INTO K_PR_ARX SELECT * FROM k_pr1000;
>
> and get this message: ORA-00947 not enough values.
> This happened because the table k_pr1000 has got less fields than the
> table K_PR_ARX. I think exist other way to make this thing (may be
> hints, etc).
>
> Excuse me for my bad english.
> Please help me.
>
> Kevin.
> Russia.

I would not use the * but list the columns explicitly. Then, just add NULL for each extra column. So assuming k_pr1000 has columns aa, bb, and cc and K_PR_ARX has columns aa, ab, ac, ad, and ae then try using:

INSERT INTO K_PR_ARX SELECT aa, bb, cc, NULL, NULL FROM k_pr1000;

Enjoy,

   Ed

-- 
Edward J. Prochak   --- Magic Interface, Ltd.
Ofc: 440-498-3700
on the web at       --- http://www.magicinterface.com
email: ed.prochak_at_magicinterface.com
Received on Thu May 30 2002 - 19:20:27 CEST

Original text of this message