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;
chinmaya224Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

johnsoneSenior Oracle DBACommented:
From a quick scan of your code, my guess is the directory name in the call to UTL_FILE.FOPEN is incorrect.  Try running this query:

select directory_name from all_directories;

My guess is that the directory name is upper case.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alexander Eßer [Alex140181]Software DeveloperCommented:
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
0
chinmaya224Author Commented:
Thanks Boss ... this was a very silly Mistake ...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.