Q

SQL commands to copy selected records from old system to new

If I have 100 records in one system and I want to move only 15 selected records from the old system to a new system. Are there any commands in SQL to copy that data?

If I have 100 records in one system and I want only 15 selected records from the old system in a new system, are there any commands in SQL to copy that data from one system to another system?
The first thing to do is to formulate the SQL to select only those 15 records. Let's assume the SQL statement looks like the following:
SELECT * FROM my_table WHERE deptno=15;
I can then create a database link to the other database and then insert data in to a table in the other database link as follows:
INSERT INTO remote_table@remote_db 
SELCT * FROM my_table WHERE deptno=15;
You can also use this with the export and import utilities. Create a dump file containing the records from the table:
exp userid=scott tables=emp file=emp.dmp where='deptno=15'
Then import the dump file into the other database.
This was first published in March 2007

Dig deeper on Oracle and SQL

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close