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;