Thanks for the question, Phong.
Asked: January 08, 2018 - 5:16 pm UTC
Last updated: November 06, 2024 - 2:51 pm UTC
Version: 12.2.1.0
Viewed 10K+ times! This question is
Jonathan Taylor, January 09, 2018 - 12:13 pm UTC
create or replace and compile java source named directorylist as package yourorganisation.directorylist; import java.io.*; import java.net.*; import java.util.ArrayList; import java.util.Arrays; public class DirectoryList { static ArrayList globalFileList; /**********************************************************************/ /* Get the listing as a string array, and stores in globalFileList */ public static void getListing (String directory) { File path = new File( directory ); String[] list = path.list(); /* Convert array to ArrayList (to allow removal of element 0)*/ globalFileList = new ArrayList (Arrays.asList (list)); } /**********************************************************************/ /* Gets the next name from the list. return "" if end of list. */ public static String nextFileName() { String fileName=""; if (globalFileList.size()>0) { fileName=(String)globalFileList.remove(0); } return(fileName); } }
--**************************************************************************** PROCEDURE Java_Directory_List_Get ( p_Directory_Name IN VARCHAR2 ) AS LANGUAGE JAVA NAME 'yourorganisation.directorylist.DirectoryList.getListing(java.lang.String)' ; --**************************************************************************** FUNCTION Java_Directory_List_Next_File RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'yourorganisation.directorylist.DirectoryList.nextFileName() return java.lang.String' ; --****************************************************************************
Marcus, January 10, 2018 - 8:58 am UTC
1 select * 2 from table(util.ls('YOUR_DIR_NAME')) 3 where name like '%.zip' 4 and modified >= sysdate - 3 5* and file_size > 1000000
Marcus, February 27, 2020 - 8:16 am UTC
Marcus, February 27, 2020 - 11:42 am UTC
SELECT ... FROM my_ext_table EXTERNAL MODIFY ( LOCATION 'abc.dat' )
Rajeshwaran, Jeyabal, March 03, 2020 - 10:45 am UTC
Craig, November 06, 2024 - 1:15 am UTC
New to good database design? Check out Chris Saxon's full fundamentals class.