Home » SQL & PL/SQL » SQL & PL/SQL » .FOPEN() , I thought 'w' would create a new file
.FOPEN() , I thought 'w' would create a new file [message #37980] Tue, 12 March 2002 05:09 Go to next message
theak
Messages: 3
Registered: March 2002
Junior Member
I have the following code...

DECLARE
v_fid UTL_FILE.FILE_TYPE;
textOutput VARCHAR2(1000);
BEGIN
v_fid := UTL_FILE.FOPEN('c:', 'report4.txt', 'w');
FOR aRecord IN(
SELECT ...) -- a simple query (deleted for internal reasons) :)
LOOP
textOutput := aRecord.BN || ',' || aRecord.ErrCount;
DBMS_OUTPUT.PUT_LINE(textOutput);
UTL_FILE.PUT_LINE(v_fid, textOutput);
END LOOP;
EXCEPTION
WHEN utl_file.INVALID_MODE THEN
dbms_output.put_line('Invalid mode!');
WHEN utl_file.invalid_path THEN
dbms_output.put_line('Invalid Path!');
WHEN utl_file.INVALID_operation THEN
dbms_output.put_line('Invalid operation!');
WHEN NO_DATA_FOUND THEN
dbms_output.put_line('No data found!');
WHEN utl_file.invalid_filehandle THEN
dbms_output.put_line('Wrong file');
WHEN utl_file.write_error THEN
dbms_output.put_line('Write error!');
WHEN utl_file.read_error THEN
dbms_output.put_line('Read erro!');
WHEN utl_file.internal_error THEN
dbms_output.put_line('Pl/sql error!');
UTL_FILE.FCLOSE(v_fid);
END;
/

I thought 'w' file type would create a new file regardless if it existed or not.

I keep getting the message 'Invalid Path'

can anybody help?

thanks
theak
Re: .FOPEN() , I thought 'w' would create a new file [message #37982 is a reply to message #37980] Tue, 12 March 2002 06:06 Go to previous message
Doris
Messages: 7
Registered: March 2002
Junior Member
maybe you should check your utl_file_dir in the init.ora, it has to be the same directory of your fopen path...
Previous Topic: Cursors
Next Topic: Problems in calling stored procedure from trigger...
Goto Forum:
  


Current Time: Thu Apr 25 05:18:57 CDT 2024