Page 1 of 1

COPY COMMAND

Posted: Thu Mar 12, 2009 3:16 am
by haseebkhatri
how to use copy command in strored procedure.


<b>copy from scott/tiger[[@]]orcl replace emp using select * from emp</b>

Kindly reply me ASAP

Regards
Haseeb

Posted: Mon Mar 16, 2009 3:28 am
by haseebkhatri
CREATE OR REPLACE PROCEDURE COPY_EMP as
job_no number;
BEGIN
dbms_job.submit(job_no,'copy from scott/tiger[@]orcl replace emp using select * from emp;',
SYSDATE,'SYSDATE+(60/(24*60*60))');
COMMIT;
END;


The above procedure created without any error.

But it does'nt execute.
Kindly guide me ASAP.

Regards
Haseeb

Posted: Sat Apr 04, 2009 11:31 pm
by amirtai
Hi Haseeb

The COPY command is a sqlplus command only. It is facilitated by the fact that sqlplus can connect to different databases simultaneously. PLSQL cannot.

I'm giving an example to use it as a shell script hope it could be helpful.

Amir

#!/bin/sh
sqlplus -s user/password[@]prod_db <<EOF
copy from scott/tiger[@]orcl replace emp using select * from emp
exit
EOF