Saturday, January 22, 2011

Miscellaneous - utl_file

Create a test procedure

create or replace procedure andy_file_test (
  path       in varchar2,
  filename   in varchar2,
  text  in varchar2
)
is
    output_file  utl_file.file_type;
begin
    output_file := utl_file.fopen (path,filename, 'W');

    utl_file.put_line (output_file, text);

    utl_file.fclose(output_file);
end;
/

Run the procedure

execute andy_file_test('/home/oracle/andy/file_test','andy.txt','hello world');


No comments:

Post a Comment