UTL_FILE.FOPEN() procedure not accepting path for directory ?
Posted
by Vineet
on Stack Overflow
See other posts from Stack Overflow
or by Vineet
Published on 2010-05-01T18:37:22Z
Indexed on
2010/05/01
18:47 UTC
Read the original article
Hit count: 423
I am trying to write in a file stored in c:\ drive named vin1.txt and getting this error .Please suggest!
> ERROR at line 1: ORA-29280: invalid
> directory path ORA-06512: at
> "SYS.UTL_FILE", line 18 ORA-06512: at
> "SYS.UTL_FILE", line 424 ORA-06512: at
> "SCOTT.SAL_STATUS", line 12 ORA-06512:
> at line 1
HERE is the code
create or replace procedure sal_status
(
p_file_dir IN varchar2,
p_filename IN varchar2)
IS
v_filehandle utl_file.file_type;
cursor emp Is
select * from employees
order by department_id;
v_dep_no departments.department_id%TYPE;
begin
v_filehandle :=utl_file.fopen(p_file_dir,p_filename,'w');--Opening a file
utl_file.putf(v_filehandle,'SALARY REPORT :GENERATED ON %s\n',SYSDATE);
utl_file.new_line(v_filehandle);
for v_emp_rec IN emp LOOP
v_dep_no :=v_emp_rec.department_id;
utl_file.putf(v_filehandle,'employee %s earns:s\n',v_emp_rec.last_name,v_emp_rec.salary);
end loop;
utl_file.put_line(v_filehandle,'***END OF REPORT***');
UTL_FILE.fclose(v_filehandle);
end sal_status;
execute sal_status('C:\','vin1.txt');--Executing
© Stack Overflow or respective owner