oracle - Error in opening a file residing on server through utl_file.open! -


i trying open file residing in data base server , used select * v$parameter name = 'utl_file_dir' find out directory path.

when executing code getting error. error coming "ora-29283: invalid file operation"

declare     v_file_handler utl_file.file_type;     p_dir varchar2(100):='/d04/data/edi/inbound';     v_no  number:=1;     v_file varchar2(30):='ut_file.txt';     begin     if utl_file.is_open(v_file_handler)      dbms_output.put_line('already opened');     else     v_file_handler:= utl_file.fopen(p_dir,v_file,'r');     utl_file.putf(v_file_handler,'program %s\n',sysdate);     dbms_output.put_line('not opened');     end if;     exception     when others     dbms_output.put_line(sqlerrm);     end;  

v_file_handler:= utl_file.fopen(p_dir,v_file,'r'); utl_file.putf(v_file_handler,'program %s\n',sysdate); 

you're opening file reading , attempting write it. that's bound throw error.

from oracle documentation:

utl_file.fopen (    location     in varchar2,    filename     in varchar2,    open_mode    in varchar2,    max_linesize in binary_integer)   open_mode specifies how file opened.  modes include:  r -- read text 

also,

ora-29283: invalid file operation

cause: attempt made read file or directory not exist, or file or directory access denied operating system.

action: verify file , directory access privileges on file system, , if reading, verify file exists.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -