简体   繁体   中英

using pl/sql how do I open a directory?

使用pl / sql如何打开目录?

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

请记住,您将需要具有DBA特权才能写入文件系统,或者拥有愿意授予您这些特权的DBA(在许多环境中是不太可能的)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM