PLSQL的UTL_FILE使用例子

开始

前期准备:

SQL> create directory utl as '/home/oracle/test';

Directory created.



SQL> grant execute on utl_file to scott;

Grant succeeded.



SQL> 

文件操作:

declare

  fn utl_file.file_type;

  OutputRecord VARCHAR2(255);

begin



  OutputRecord :='abcdefg';

  fn:=utl_file.fopen('UTL','test.txt','W');



  utl_file.put (fn, OutputRecord);

  utl_file.new_line (OutputFile);



  utl_file.fclose(fn);

end;

结束

你可能感兴趣的:(plsql)