create or replace directory YOURDIR
as '\path\to\your\directory';
create global temporary table DIR_LIST
(
FILENAME VARCHAR2(255),
)
on commit preserve rows;
grant select, insert, update, delete on DIR_LIST to PUBLIC;
create or replace and compile java source named dirlist as
import java.io.*;
import java.sql.*;
import java.text.*;
public class DirList
{
public static void getList(String directory)
throws SQLException
{
File dir = new File( directory );
File[] files = dir.listFiles();
File theFile;
for(int i = 0; i < files.length; i++)
{
theFile = files[i];
#sql { INSERT INTO DIR_LIST (FILENAME)
VALUES (:theName };
}
}
}
CREATE OR REPLACE PROCEDURE get_dir_list(pi_directory IN VARCHAR2)
AS LANGUAGE JAVA
name 'DirList.getList(java.lang.String)';
AskTom thread