Solved

How to merge 2 Oracle tables?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL query of Oracle 10g database. 8 76
PL/SQL LOOP CURSOR 3 57
Oracle - Stored Procedure Privilge access 3 39
VB.Net - Oracle BulkCopy from CSV Date Format 7 45
Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

911 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

19 Experts available now in Live!

Get 1:1 Help Now