日期:2014-05-16  浏览次数:20313 次

oracle应用
创建文件目录:
create or replace directory BLOBDIR as 'c:\oracleLog\';
grant read,write on directory BLOBDIR to ects;
GRANT EXECUTE ON utl_file TO ects;
select * from ALL_DIRECTORIES;

文件读取:
CREATE OR REPLACE PROCEDURE P_WRITE_EMP AS
V_FILE UTL_FILE.FILE_TYPE;
V_BUFFER VARCHAR2(32767);
BEGIN
     V_FILE := UTL_FILE.FOPEN('BLOBDIR', 'wppTrigger.log', 'A', 32767);
     V_BUFFER := 'EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO';
     UTL_FILE.PUT_LINE(V_FILE, V_BUFFER);
     UTL_FILE.FCLOSE(V_FILE);
END;