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: Beginner - copying data from one table to another

Re: Beginner - copying data from one table to another

From: Mark Muller <mmu_at_beer.com>
Date: Fri, 6 Dec 2002 09:49:37 +0100
Message-ID: <aspob2$ot9$1@news.hccnet.nl>


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

Original text of this message

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