SQL commands to copy selected records from old system to new

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?

    Requires Free Membership to View

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

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.