Oracle
 sql >> Database >  >> RDS >> Oracle

Ottenere il timestamp di un file utilizzando PL/SQL

Penso che dovrai farlo scrivendo una procedura java, come descritto qui da Tom Kyte:

http://asktom. oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:439619916584

GRANT JAVAUSERPRIV to <your user>
/
create global temporary table DIR_LIST
( filename varchar2(255) )
  on commit delete rows
/
create or replace and compile java source named "DirList"
    as
    import java.io.*;
    import java.sql.*;

    public class DirList
    {
      public static void getList(String directory)
                       throws SQLException
      {
        File path = new File( directory );
        String[] list = path.list();
        String element;

        for(int i = 0; i < list.length; i++)
        {
            element = list[i];
            #sql { INSERT INTO DIR_LIST (FILENAME)
                   VALUES (:element) };
        }
      }
    }
/
create or replace procedure get_dir_list( p_directory in varchar2 )
    as language java
    name 'DirList.getList( java.lang.String )';
/