Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to merge 2 Oracle tables?

Posted on 1998-01-13
2
Medium Priority
?
1,360 Views
Last Modified: 2008-03-04
How do I use the 'INSERT' or 'SELECT' SQL to copy all records from one table to another table, assuming the two tables have the same schema and I have all the privileges?
0
Comment
Question by:szetoa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
frankr earned 150 total points
ID: 1081732
If your second table is simply an exact copy of the first, the EASIEST way to do this is to issue a

CREATE TABLE new_table AS SELECT * FROM old_table;

You create the new table and copy all the data in one statement.

If the second table already has some data and the table structures are identical (i.e. column names in the two tables are identical in name, number, type, etc.), you can simply

INSERT INTO new_table SELECT * FROM old_table;

If the structures aren't identical, start adding explicit column lists to the new_table and the old_table.
0
 
LVL 1

Author Comment

by:szetoa
ID: 1081733
Thanks again.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to recover a database from a user managed backup

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question