Link to home
Start Free TrialLog in
Avatar of chinmaya224
chinmaya224Flag for India

asked on

PL/SQL - Help needed on UTL_FILE Package

Hi,

Please help me :

I have created a folder in Linux as
/home/oracle/chinu

Then i have created a directory as testfile1 by giving the path /home/oracle/chinu.

Now i have written the below dummy package and when i am executing it s giving me a
error as Directory Not Found.


create or replace
PACKAGE body file_function
IS
PROCEDURE file_import
IS
  file_handle utl_file.file_type;
   v_file_name VARCHAR2(10) := 'test.txt';
BEGIN
  file_handle := SYS.utl_file.fopen('testfile1',v_file_name,'R');
  IF SYS.utl_file.is_open(file_handle) THEN
    SYS.utl_file.fclose(file_handle);
    dbms_output.put_line('Close Successfully');
  END IF;
EXCEPTION
WHEN OTHERS THEN
  dbms_output.put_line(sqlerrm);
END file_import;
END file_function;
ASKER CERTIFIED SOLUTION
Avatar of johnsone
johnsone
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
johnsone's right, this is from official Oracle docs:

Directory location of file. This string is a directory object name and must be specified in upper case. Read privileges must be granted on this directory object for the UTL_FILE user to run FOPEN.

no pts please
Avatar of chinmaya224

ASKER

Thanks Boss ... this was a very silly Mistake ...