Read a Directory using PLSQLPosted: November 9, 2010
In Oracle 10G there is not UTL function / procedure to read the listing of a directory.
There is a undocumented procedure that can be used
CREATE OR REPLACE PROCEDURE list_directory
v_directory := directory;
FOR each_file IN (SELECT fname_krbmsft AS name FROM x$krbmsft) LOOP
This must be compiled as SYS and then EXECUTE permision granted to the relevat user. Care must be taken on who should have access to this, I would suggest not giving it out to all user including poer users but limit it to perhaps a batch processing user. This is where most of the benefit I believe will come from.
Grant execute of List_Directory to XXXXXXXX;
This then can be wrappered in a PLSL procedure a quick example below
for each_file in (SELECT FNAME_KRBMSFT AS name FROM X$KRBMSFT) loop
TO BE CONTINUED, time for home 🙂