COPY COMMAND

In this forum you can share stuff related to Oracle 11g, 10g, 9i.
Post Reply
haseebkhatri
Posts: 18
Joined: Fri Sep 19, 2008 1:11 am
Location: Pakistan

COPY COMMAND

Post 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
haseebkhatri
Posts: 18
Joined: Fri Sep 19, 2008 1:11 am
Location: Pakistan

Post 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
amirtai
Posts: 138
Joined: Sat Apr 08, 2006 5:54 pm
Location: Canada
Contact:

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests