Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: match columns on insert sub select
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
![]() |
![]() |