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!

How to read .csv file from FTP or SFTP server using Oracle PL SQL?

3413742Mar 20 2018 — edited Mar 22 2018

I tried the below code and it showing output like SSH-2.0-OpenSSH_5.3 that means connected i hope.

 declare c  utl_tcp.connection;  -- TCP/IP connection to the Web server ret_val pls_integer;
BEGIN c := utl_tcp.open_connection(remote_host => 'ftp.******.******.com'
                                   ,remote_port =>  21 ,charset => 'US7ASCII' --                             
                                   ,wallet_path     => '****************'
--                             
                                   ,wallet_password => '**********'
);  -- open connection
--  ret_val := utl_tcp.write_line(c, 'GET / HTTP/1.0');    -- send HTTP request
ret_val
:= utl_tcp.write_line(c);
BEGIN LOOP dbms_output.put_line(utl_tcp.get_line(c, TRUE));  -- read result
END LOOP;
EXCEPTION
WHEN utl_tcp.end_of_input THEN NULL; -- end of input
END;
utl_tcp
.close_connection(c);
END;
/

Could someone help me on next steps on How to open and read the .csv file present in SFTP/FTP server and load it into Oracle DB table ?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 19 2018
Added on Mar 20 2018
17 comments
3,334 views