Solved

How to merge 2 Oracle tables?

Posted on 1998-01-13
2
1,337 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
2 Comments
 
LVL 2

Accepted Solution

by:
frankr earned 50 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now