Declare
v_filehandle UTL_FILE.FILE_TYPE;
file_dir VARCHAR2(50) :=’/db3/oracle/utlfiles’;
begin
t_file_name :=’Vatti_test.dat’;
v_filehandle := UTL_FILE.FOPEN(file_dir, t_file_name, ‘w’);
UTL_FILE.PUT_LINE(v_filehandle, ‘Hello TEST’);
UTL_FILE.FCLOSE(v_filehandle);
exception
when others then
dbms_output.put_line(sqlcode || ‘ ‘ || sqlerrm);
end;
/