0

using pl/sql how do I open a directory?

OMG Ponies
  • 325,700
  • 82
  • 523
  • 502
Kevin
  • 11
  • 1
  • 1
  • 3

2 Answers2

1

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
  • 325,700
  • 82
  • 523
  • 502
0

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).

wadesworld
  • 13,535
  • 14
  • 60
  • 93