Search This Blog

Thursday, July 28, 2022

Get file names in Oracle Directory in IFS without using Complied Java Source

DECLARE
   file_handle_      UTL_FILE.FILE_TYPE;
   directory_name_   all_directories.directory_name%TYPE;
   file_list_        Intface_File_Types := Intface_File_Types();
   file_count_       NUMBER;
   
   FUNCTION Get_File_Count (
      temp_directory_name_ IN VARCHAR2 ) RETURN NUMBER
   IS
      file_count_       NUMBER;
      temp_file_list_   Intface_File_Types := Intface_File_Types();
   BEGIN
      file_count_ := 0;
      
      temp_file_list_ := Intface_Server_File_API.File_List(temp_directory_name_);
   
      FOR i IN 1..temp_file_list_.count LOOP
         file_count_ := file_count_ + 1;
      END LOOP;
      
      RETURN file_count_;
   END Get_File_Count;
BEGIN
   directory_name_ := 'ORACLE_DIRECTORY_NAME';
   file_count_     := Get_File_Count(directory_name_);
      
   IF (file_count_ > 0) THEN
      Dbms_Output.Put_Line(directory_name_ || ' - ' || file_count_);
         
      file_list_ := Intface_Server_File_API.File_List(directory_name_);
   
      FOR i IN 1..file_list_.count LOOP
         Dbms_Output.Put_Line(file_list_(i).file_name);
      END LOOP;
   END IF;
END;

Related Links:

> Get file names in an Oracle Directory using Java in Oracle PL/SQLL

No comments:

Post a Comment

Read file content from an Oracle Directory in PL/SQL/ in IFS

Read single file DECLARE file_handle_ UTL_FILE.FILE_TYPE; directory_name_ CONSTANT all_directories.directory_name%TYPE := '...

Popular Posts