tags:

views:

40

answers:

2

using pl/sql how do I open a directory?

+1  A: 

This is only valid for Oracle 10g+ (lots of info in the comment here):

DECLARE

  pattern VARCHAR2(1024) := 'C:\temp\*';
   ns VARCHAR2(1024);

BEGIN
  SYS.DBMS_BACKUP_RESTORE.searchFiles(pattern, ns);

  -- List files in the directory
  FOR each_file IN (SELECT FNAME_KRBMSFT AS name FROM X$KRBMSFT) LOOP
    DBMS_OUTPUT.PUT_LINE(each_file.name);
  END LOOP;

END;
/
OMG Ponies
A: 

Keep in mind you'll need DBA privileges to write to the file system, or have a DBA that's willing to grant you those privileges (which in many environments is not likely).

Wade Williams