How to use the copy command in Oracle SQL

Author:

How to use the copy command in Oracle SQL

Syntax:

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

where database has the following syntax:

username[/password]@connect_identifier

Copies data from a query to a table in a local or remote database. COPY supports the following datatypes:

    CHAR
    DATE
    LONG
    NUMBER
    VARCHAR2

Examples

—-To copy a table from schema-name1 to schema-name2

COPY FROM schema1/service1  TO schema2/service2 CREATE table_name USING select * from table_name;

—-To append a table from schema-name1 to schema-name2

COPY FROM schema1/service1 append appldata using select * from appldata;
 
—-To insert into table from schema-name1 to schema-name2

COPY FROM schema1/service1  TO schema2/service2 insert into table_name using select * from table_name;

Refer to this article for seeing Copy Command Demonstrations.
http://www.lc.leidenuniv.nl/awcourse/oracle/server.920/a90842/apb.htm

Author:Pratibha

Leave a Reply

Your email address will not be published. Required fields are marked *