How do you create a physical directory on the OS from within PL/SQL? I looked at the CREATE OR REPLACE DIRECTORY
command but that doesn't do it. Neither does UTL_FILE
appear to be capable.
UTL_FILE
still lacks this capability - probably a holdover from the pre-DIRECTORY
object days where you had to explicitly define the OS file directories you could access in a startup parameter, so there was no need to create directories dynamically anyway.
I think the easiest way to do this is with an Oracle Java stored procedure that uses:
File f = new File(dirname);
return (f.mkdir()) ? 1 : 0;
If you go this route make sure that you use dbms_java.grant_permission
to grant java.io.FilePermission
to the user that owns the executing code.