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: match columns on insert sub select

Re: match columns on insert sub select

From: Sybrand Bakker <gooiditweg_at_sybrandb.demon.nl>
Date: Thu, 31 Jul 2003 19:41:33 +0200
Message-ID: <24liivg5eeri5a3lrpc5g44drc146kgp4s@4ax.com>


On Thu, 31 Jul 2003 10:21:11 -0700, "Dan." <dan_at_nospam.edu> wrote:

>Anyone know of an easy way to copy data from table to table that will match
>up exact same named columns from the source to the target?
>
>
>TABLE1 (source)
>
>FIELDA
>FIELDB
>FIELDC
>FIELDD
>
>
>
>TABLE2 (target)
>
>FIELDB
>FIELDA
>FIELDD
>FIELDC
>FIELDE
>FIELDF
>FIELDG
>
>
>A script would work but ideally it would be a keyword so you could do
>something like this?
>
>INSERT INTO TABLE2
> (SELECT MATCHING * FROM TABLE1)
> -----------------
>
>instead of having to write out
>
>INSERT INTO TABLE2
> (SELECT
> FIELDB
> FIELDA
> FIELDD
> FIELDC
> '',
> '',
> ''
> FROM TABLE1)
>
>
>Thanks for any responses, -Dan
>

If your hands are too crippled for copy and paste, and you are too lazy too type and too lazy to verify in the manual there is no such thing, wouldn't you have better spent your time on generating your query from user_tab_columns?

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Thu Jul 31 2003 - 12:41:33 CDT

Original text of this message

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