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!

Oracle FTP

sliderrulesJun 6 2015 — edited Jun 8 2015

Hi,

I am using Oracle database version 11.1.2 and have a requirement to FTP a file off a directory(/Data) to a server. The directory contains a list of files and I would like to be able to select the file to transfer using a wildcard.

The script below returns a list of files

DECLARE

  l_conn  UTL_TCP.connection;

  l_list  ftp.t_string_table;

l_file      VARCHAR2(100);

BEGIN

  l_conn := ftp.login('somewhere@co.uk', '21', 'testuser', 'test');

  ftp.list(p_conn   => l_conn,

           p_dir   => '/Data,

           p_list  => l_list);

  ftp.logout(l_conn);

 

  IF l_list.COUNT > 0 THEN

    FOR i IN l_list.first .. l_list.last LOOP

      DBMS_OUTPUT.put_line(i || ': ' || l_list(i));

    END LOOP;

  END IF;

END;

File name listing:

Oracle.csv

MySQL.csv

IBM.csv

Access.csv

I would like the script to return the file name Oracle.csv. Is it possible to add something like:

select l_file

into l_list

where l_file like 'Oracle%';

l_file:= l_list;

This post has been answered by Pk on Jun 7 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 6 2015
Added on Jun 6 2015
7 comments
951 views