I want to retrive the rows from a table and write to a file in one directory. So I used UTL_FILE package and I have created a directory in init.ora file also. But when I execute the procedure, I get the following error message.
ORA-06510 - PL/SQL unhandled user defined exception.
ORA-06512 - at "SYS.UTL_FILE", line 101
ORA-06512 - at "SYS.UTL_FILE", line 157
The code is as follows:
cursor c1 is
select * from precord;
v_filedir := '/usr5/mis/output_files'; /* (OUtput_files is the directory)*/
v_filename := 'test.out';
v_handle := UTL_FILE.FOPEN(v_filedir, v_filename, 'w');
for rec in c1 loop
UTL_FILE.PUTF(v_handle, 'Employee name: %s\n', rec.ename);
Kindly help me.
There is a possiblity that you have not mounted the disk where you are writng the file so please check it.
Click Here to Expand Forum to Full Width