News
Perth, Australia
+ (61) 417713124
prosolutions@gavinsoorma.com

UTL_FILE_DIR path test

  • Posted by Arjun Raja
  • On July 10, 2009
  • 0 Comments

To test if the utl_file_dir path in the init.ora file can indeed be written to .

Login as sysdba –

1. Create a test procedure

CREATE OR REPLACE procedure utl_file_test_write (
path in varchar2,
filename in varchar2,
firstline in varchar2,
secondline in varchar2)
is
output_file utl_file.file_type;
begin
output_file := utl_file.fopen (path,filename, ‘W’);

utl_file.put_line (output_file, firstline);
utl_file.put_line (output_file, secondline);
utl_file.fclose(output_file);

–exception
— when others then null;
end;
/

Now run a test –

begin
utl_file_test_write (
‘/tmp’,
‘utl_file_test’,
‘first line’,
‘second line’
);
end;
/

If ‘/tmp’ is not a part of the UTL_FILE_DIR path in the init.ora, then this test will fail.

 

0 Comments

Leave Reply

Your email address will not be published. Required fields are marked *