Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

UTL_TCP

jaggyamJan 20 2006 — edited Jan 23 2006
Hi all,

I am using UTL_TCP to do multiple delete(i.e ex*.*) in remote server which is not working not throwing an error either. If I try to delete a single file, it works fine.

1. I am not able to change my working directory by using CWD command.
2. Deleting a single file is working if I give the path along with the file name. ie /home/user/a/a.sql.
3. I am not able to use wildcard characters in delete statement.
4. What command is these CWD and DELE


Also I need to know is it the same as FTP or which command it recogonizes, is that the remote machines OS command.

Code is given below.

CREATE OR REPLACE PROCEDURE DELETE_ASCIIFILES(host_name IN Varchar2,
ftp_user IN Varchar2,
ftp_pwd IN Varchar2,
path_file IN Varchar2 ,
name_file IN Varchar2 ) IS

l_conn UTL_TCP.connection;
l_result PLS_INTEGER;
BEGIN
DBMS_OUTPUT.PUT_LINE('STARTING..');
l_conn := UTL_TCP.open_connection(host_name,'21');
l_result := UTL_TCP.write_line(l_conn, 'USER ' || ftp_user);
l_result := UTL_TCP.write_line(l_conn, 'PASS ' || ftp_pwd);
l_result := UTL_TCP.write_line(l_conn,'CWD ' || path_file);
l_result := UTL_TCP.write_line(l_conn,'DELE ' || name_file);
UTL_TCP.close_all_connections;
DBMS_OUTPUT.PUT_LINE('ENDING...'||l_result);

EXCEPTION
WHEN UTL_TCP.NETWORK_ERROR THEN
DBMS_OUTPUT.PUT_LINE('network error..');
WHEN UTL_TCP.BAD_ARGUMENT THEN
DBMS_OUTPUT.PUT_LINE('bad argument error');
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('some error..');

END;

Thanks in advance
Jaggy
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 20 2006
Added on Jan 20 2006
5 comments
660 views