PLSQL操作文件

conn sys/sys as sysdba;

create directory UTL_FILE_DIR_TMP as '/home/oracle/test';

grant read,write on directory UTL_FILE_DIR_TMP to cfmmc;

grant execute on UTL_FILE to cfmmc;

在cfmmc中创建存贮过程
CREATE OR REPLACE PROCEDURE FILETEST(fileName IN VARCHAR2) as
       dir VARCHAR2(1000);
begin
     

     dir := 'UTL_FILE_DIR_TMP';
     DBMS_OUTPUT.PUT_LINE('dir='||dir);
     DBMS_OUTPUT.PUT_LINE('fileName='||fileName);
     UTL_FILE.FREMOVE (dir,fileName);
     DBMS_OUTPUT.PUT_LINE(fileName||'**fileName delete OK');
end;

conn cfmmc/cfmmc;

exec filetest('aa.txt');

 

你可能感兴趣的:(oracle)