Re: Copy command

From: Madhu Cherukuri <Madhu.Cherukuri_at_worldnet.att.net>
Date: 1998/01/30
Message-ID: <6au7mj$gf8_at_bgtnsc03.worldnet.att.net>#1/1


I think it's someting you are missing with the syntax Here is some examples from the doc.

The following command copies the entire EMP table to a table named WESTEMP. Note that the tables are located in two different databases. If WESTEMP already exists, SQL*Plus replaces the table and its contents. The columns in WESTEMP have the same names as the columns in the source table, EMP.

SQL> COPY FROM SCOTT/TIGER_at_HQ TO JOHN/CHROME_at_WEST -
> REPLACE WESTEMP -
> USING SELECT * FROM EMP

The following command copies selected records from EMP to the database to which SQL*Plus is connected. SQL*Plus creates SALESMEN through the copy. SQL*Plus copies only the columns EMPNO and ENAME, and at the destination names them EMPNO and SALESMAN.

SQL> COPY FROM SCOTT/TIGER_at_HQ -
> CREATE SALESMEN (EMPNO,SALESMAN) -
> USING SELECT EMPNO, ENAME FROM EMP -
> WHERE JOB='SALESMAN'
There are three options when copying
create - Creates a new table
insert - inserts into an existing table replace - replaces with new table if the table already exists

HTH Madhu Cherukuri <Madhu.Cherukuri_at_worldnet.att.net>

Nigam wrote in message <34d262d7.23010056_at_news>...
>All,
> HELP!! Desparate help needed - have to implement this in the
>Production database
>
>I am using the Copy command in Sql*Plus to copy data between tables
>which belong to the same user, same tablespace, etc. In other words ,
>it is a local copy. I do this to migrate data from the old database
>structure to a new structure.
>
>First, I used
>
>Copy Insert <new_table> Using Select * from <old_table>
>
>It said, have to use one of From or To
>
>So,
>
>Copy from user/pwd Insert <new_table> Using Select * from <old_table>
>
>It said, have to specify the _at_database specification
>
>So, I created an entry in tnsnames.ora, create a public database link
>from the Oracle user to itself. When I use this database link to
>describe a table or select from a table as in
>
>desc table_at_dblink or select * from table_at_dblink
>
>it works fine.
>
>But when I used,
>
>copy from user/pwd_at_dblink to user/pwd_at_dblink -
>Insert new_table-
>Using Select * from old_table;
>
>It gave ORA-12154
>
>Array fetch/bind size is 15. (arraysize is 15)
>Will commit when done. (copycommit is 0)
>Maximum long size is 80. (long is 80)
>
>ERROR:
>ORA-12154: TNS:could not resolve service name
>
>
>I have to get this done NOW. Please help!
>
>
>Thanks a lot,
>
>Nigam
Received on Fri Jan 30 1998 - 00:00:00 CET

Original text of this message