Finally, I learned the Copy command in the Oracle database.

Source: Internet
Author: User

Copy command of SQL * Plus

Copying data between data tables is one of the tasks that Oracle DBAs often face. Oracle provides a variety of solutions for this task. The SQL * Plus Copy command is one of them. The SQL * Plus Copy command uses SQL * Net to Copy or move data between different tables (the same server or different servers.

In the actual running environment, selecting the SQL * Plus Copy command can effectively improve the data replication performance.

The following describes how to use the SQL * Plus Copy Command, and compares the performance with the other two solutions, so as to provide a reference for using the Copy command.

Syntax and usage instructions

Syntax:

Next, let's take a look at the syntax and usage of the SQL * Copy command.

Before interpreting the syntax of the SQL * Plus Copy command, we must clarify that the SQL * Plus Copy command is neither a method nor a function nor an SQL statement. It is a command ), of course, this command must be run in SQL * Plus.

Syntax of the SQL * Plus Copy command:

       
        COPY {FROM database | TO database | FROM database TO database} {APPEND|CREATE|INSERT|REPLACE} destination_table [(column, column, column, ...)]USING query
       

Here, we will explain the Division:

COPY-this does not need to be explained. The main command declares that the COPY operation is required.

From Database-source Database.

To Database-target Database.

Note that there are three optional statements in brackets (separated by "|"). If the source and target data tables are in the same Schema, you can write only From Database, you can also write only To Database. Of course, it can also be the third method, which fully writes From Database and To Database. However, if the source and target data tables are not in the same Schema, you must write the From Database and To Database in the same format: USERID/PASSWORD @ SID.

{APPEND | CREATE | INSERT | REPLACE}-Method of declaring operation data. The following describes the methods respectively:

Append-Append a record to an existing target table. If the target table does not exist, it is automatically created. This is equivalent to Create.

Create-Create a target table and add records to it. If the target table already exists, an error is returned.

Insert-Insert a record into an existing target table. Unlike Append, if the target table does not exist and is not created automatically, an error is returned.

Replace-overwrite existing data in the target table with the queried data. If the target table does not exist, it is automatically created.

Destination_table-name of the target table

[(Column,...)]-You can specify the name of the column in the target table. If this parameter is not specified, the column name in the Query is automatically used.

  • 1
  • 2
  • Next Page
[Content navigation]
Page 1st: finally learned the Copy command in the Oracle database Page 2nd: finally learned the Copy command in the Oracle database

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.