Saturday 17 August 2013

Copy Command-copy data from one database to another database



Copies data from a query to a table in the same or another database. COPY supports CHAR, DATE, LONG, NUMBER and VARCHAR2.



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





Example:



copy from hr/hr@orcl to hr/hr@orcl insert emp2 using select * from emp;



copy from hr/hr@orcl to scott/tiger@orcl insert abc using select * from employees;



copy from hr/hr@orcl to scott/tiger@orcl create dep_id (dep_id,dep_name,man_id,loc_id) using select * from departments;



copy from hr/hr@orcl to scott/tiger@orcl replace employee using select * from employees;


No comments:

Post a Comment