9

Is it possible to get a list of all files (and their extensions) that are stored in a specified directory using only PL/SQL? (without using Java procedures and other fancy things. Just plain PL/SQL code)

P.S. If it is possible, please tell me how to do that :)

Denys
  • 4,287
  • 8
  • 50
  • 80
  • 1
    Are you talking about "Oracle" directories created wit `CREATE DIRECTORY` or any arbitrary OS-level directory? –  Jul 01 '13 at 12:43
  • a specific "Oracle" directory – Denys Jul 01 '13 at 12:49
  • 1
    No less an authority than [Tom Kyte](http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:439619916584) says it can't be done in PL/SQL, so I guess I'm going with that. On his blog @JeffreyKemp has an interesting [solution which uses Java](http://jeffkemponoracle.com/2010/08/10/directory-file-list-in-plsql/), which may be as good as it gets. Share and enjoy. – Bob Jarvis - Слава Україні Jul 01 '13 at 17:14
  • Have to agree with you. It is not possible. Java is the way to go – Denys Jul 02 '13 at 11:17
  • 3
    it can be done. period. possible solution (although involves some "weird rights' granting") based on using **SYS.DBMS_BACKUP_RESTORE.searchFiles** here: https://davidalejomarcos.wordpress.com/2011/09/13/ or here: http://abilim.blogspot.com/2014/09/how-to-list-files-on-directory-from.html – WojciechP Dec 08 '16 at 09:55

1 Answers1

1

This is not possible with plain PL/SQL but without Java. You can use a scheduler job for creating a directory listing: See https://stackoverflow.com/a/16845563/802058

Community
  • 1
  • 1
Toru
  • 905
  • 1
  • 9
  • 28