to MohankNair: It is possible to transfer files using FTP between servers. There are some existing packages out there to do this.
Main Topics
Browse All Topics
Hi.
I need to transfer set of files (txt,rpt etc..) from one server to other using a Oracle PL/SQL procedure/function. Using FTP.GET function we can transfer files one by one and also we have to give the file names as a parameter. How can we do this if we don't know the file names and we need to transfer all the file in a folder. Please help.
Regards.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
CREATE OR REPLACE DIRECTORY my_docs AS '/u01/app/oracle/';
SET SERVEROUTPUT ON SIZE 1000000
@c:\ftp.pks
@c:\ftp.pkb
-- Retrieve an ASCII file from a remote FTP server.
DECLARE
l_conn UTL_TCP.connection;
BEGIN
l_conn := ftp.login('ftp.company.com
ftp.ascii(p_conn => l_conn);
ftp.get(p_conn => l_conn,
p_from_file => '/u01/app/oracle/test.txt'
p_to_dir => 'MY_DOCS',
p_to_file => 'test_get.txt');
ftp.logout(l_conn);
utl_tcp.close_all_connecti
END;
/
-- Send an ASCII file to a remote FTP server.
DECLARE
l_conn UTL_TCP.connection;
BEGIN
l_conn := ftp.login('ftp.company.com
ftp.ascii(p_conn => l_conn);
ftp.put(p_conn => l_conn,
p_from_dir => 'MY_DOCS',
p_from_file => 'test_get.txt',
p_to_file => '/u01/app/oracle/test_put.
ftp.logout(l_conn);
utl_tcp.close_all_connecti
END;
/
-- Retrieve a binary file from a remote FTP server.
DECLARE
l_conn UTL_TCP.connection;
BEGIN
l_conn := ftp.login('ftp.company.com
ftp.binary(p_conn => l_conn);
ftp.get(p_conn => l_conn,
p_from_file => '/u01/app/oracle/product/9
p_to_dir => 'MY_DOCS',
p_to_file => 'jobs_get.gif');
ftp.logout(l_conn);
utl_tcp.close_all_connecti
END;
/
-- Send a binary file to a remote FTP server.
DECLARE
l_conn UTL_TCP.connection;
BEGIN
l_conn := ftp.login('ftp.company.com
ftp.binary(p_conn => l_conn);
ftp.put(p_conn => l_conn,
p_from_dir => 'MY_DOCS',
p_from_file => 'jobs_get.gif',
p_to_file => '/u01/app/oracle/jobs_put.
ftp.logout(l_conn);
utl_tcp.close_all_connecti
END;
/
ofcourse the copyright is to:-
http://www.oracle-base.com
let us know if anything doesnt work. We'll be glad to solve it.
Business Accounts
Answer for Membership
by: MohanKNairPosted on 2006-06-05 at 00:55:17ID: 16831205
Oracle PL/SQL procedure/function cannot transfer files. Oracle installed in two servers can communicate using a DB LINK. It is not possible to transfer LOB fields over a db link.
The best option for transfering a complete folder is to ZIP the entrire folder to a single file or using tar compress the folder to a tar file. FTP the zipped file and unzip the file at other server.