util_file error about invalid path [message #39398] |
Mon, 15 July 2002 02:44 |
sornwitha
Messages: 1 Registered: July 2002
|
Junior Member |
|
|
After run this script the error was found as below:
What should i do for this error message about the invalid path?
SQL> set serveroutput on size 99999
SQL> declare
2 filehandler UTL_FILE.FILE_TYPE;
3 log_dir varchar2(80) := 'e:';
4 log_fname varchar2(80) := 'test.txt';
5
6 l_str varchar2(1000);
7 l_f1 varchar2(15);
8 l_f2 varchar2(15);
9
10 begin
11 filehandler := UTL_FILE.FOPEN(log_dir,log_fname,'r');
12 loop
13 utl_file.get_line(filehandler,l_str);
14 dbms_output.put_line(l_str);
15 l_f1 := substr(l_str,1,15);
16 l_f2 := substr(l_str,16,15);
17 dbms_output.put_line(l_f1);
18 dbms_output.put_line(l_f2);
19 end loop;
20 utl_file.fclose(filehandler);
21
22 EXCEPTION
23 When no_data_found THEN
24 UTL_FILE.FCLOSE(fileHandler);
25 WHEN utl_file.invalid_path THEN
26 DBMS_OUTPUT.PUT_LINE('Error: invalid path ' || SQLERRM);
27 UTL_FILE.FCLOSE(fileHandler);
28 WHEN utl_file.write_error THEN
29 DBMS_OUTPUT.PUT_LINE('Error: write error ' || SQLERRM);
30 UTL_FILE.FCLOSE(fileHandler);
31 WHEN others then
32 DBMS_OUTPUT.PUT_LINE('Error: other error ' || SQLERRM);
33 UTL_FILE.FCLOSE(fileHandler);
34 END;
35 /
Error: invalid path User-Defined Exception
PL/SQL procedure successfully completed.
|
|
|
Re: util_file error about invalid path [message #39410 is a reply to message #39398] |
Mon, 15 July 2002 16:04 |
andrew again
Messages: 2577 Registered: March 2000
|
Senior Member |
|
|
UTL_FILE can only access files on the server, and as you have the path as 'e:' -- that must be a path on your NT server where Oracle is running.
select value from v$parameter where name = 'utl_file_dir';
* means access to read/write to any directory which Oracle can access (very bad), else a list of permitted directories. You can't do something like 'e:abc*' to allow all subdirectories - they must be individually specified. Make sure the 'e:' or '*' are returned by the query above. If not -- that directory need to be added to the init.ora.
|
|
|