0

using pl/sql how do I open a directory?

2 Answers 2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.