2

I'm trying to read from a file with oracle db using UTL_FILE. I can't find a file location I have access to. Whenever I use this code:

DECLARE 
  F1 UTL_FILE.FILE_TYPE; 
BEGIN 
  F1 :=UTL_FILE.FOPEN('C:\TEMP','test_file.txt','R'); 
END;

I get: ORA-29280: invalid directory path

Why would that be?

Can I somehow make oracle show the location I have access to?

BR Kresten

1 Answer 1

2

UTL_FILE.FOPEN uses DBA_DIRECTORIES.

SELECT * from ALL_DIRECTORIES 

gives you defined and accessible DBA_DIRECTORIES.

You can create directory for your File operations

CREATE DIRECTORY File_Op_Dir AS '/u01/fileDir';
GRANT READ ON DIRECTORY File_Op_Dir TO <<user>>;
--IF you need write permission 
GRANT WRITE ON DIRECTORY File_Op_Dir TO <<user>>; 

Then

 F1 := UTL_FILE.FOPEN('File_Op_Dir','u12345.tmp','R'); 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.