using pl/sql开发者_如何学运维 how do I open a directory?
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;
/
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).
精彩评论