Sunday, April 13, 2008

SQL*Plus COPY Command

About COPY Command:
1)The COPY command will be obsoleted in future releases of SQL*Plus. No new datatypes will be supported by COPY.

2)The Syntax of the copy command is,

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

3)Copy Command copies data from a query to a table in the same or another database. COPY supports the following datatypes: CHAR,DATE,LONG,NUMBER,VARCHAR2


Example:
In my TNSNAMRES.ORA I have two entry of THERA and ARJU.Now using copy command I copied table a from THERA to AJRU and rename it as a1.

SQL> copy from arju/a@THERA to arju/a@ARJU create a1 using select * from a;

Array fetch/bind size is 15. (arraysize is 15)
Will commit when done. (copycommit is 0)
Maximum long size is 80. (long is 80)
Table A1 created.

1 rows selected from arju@THERA.
1 rows inserted into A1.
1 rows committed into A1 at arju@ARJU.

No comments:

Post a Comment