Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Beginner - copying data from one table to another
Thanks,
Oracle 9i
The problem is tab2 is the current table used for a program, tab1 is the
current table used at a customer site
I was looking for the command to copy the data where column names are the
same, without nowing the exact layout of Tab1, but i know the name (and
tablespace) of the old and new table
> The simplest answer is to simply write an INSERT statement with a
> subquery instead of a VALUES clause
> e.g.
> INSERT INTO tab2 (ID, NAME)
> SELECT ID, NAME FROM tab1
> >Tab1
> > ID CHAR(10)
> > NAME CHAR(30)
> > PHONE CHAR(15)
> >
> >Tab2
> > ID CHAR(10)
> > FNAME CHAR(10)
> > NAME CHAR(30)
> >
> >Can i write a script that will insert all rows from Tab1 into Tab2 for
the
> >identical column names
Received on Fri Dec 06 2002 - 02:49:37 CST