0

I work with UTL_FILE. I want to create a file in 'C:\pruebaoracle'.

I create a directory with:

create or replace directory test1 as 'C:\pruebaoracle';

grant read, write on test to public; 

The procedure is

CREATE OR REPLACE PROCEDURE PRUEBAFICHEROTRAZA AS 
 F1 UTL_FILE.FILE_TYPE;
BEGIN
F1 := UTL_FILE.FOPEN('test1','prueba.tmp','w'); 


UTL_FILE.put_line(F1,'Start processing file at : ' || systimestamp);
UTL_FILE.put_line(F1,'End processing file at :'||systimestamp);  
 -- Close file  
UTL_FILE.FCLOSE(F1); 
END PRUEBAFICHEROTRAZA;

When I execute the procedure I get the error:

ORA-29280: invalid directory path

How can I create the file?

APC
  • 144,005
  • 19
  • 170
  • 281
Carlota
  • 1,239
  • 3
  • 29
  • 59
  • 2
    Does the physical folder exist on the Oracle server, and can the Oracle process owner see it and write to it? – William Robertson Aug 29 '18 at 15:08
  • 3
    Is it a typo here or in the command that you create directory as `test1` and grant on `test`? – Sianur Aug 29 '18 at 15:09
  • 2
    Is `C:\pruebaoracle` directory on same machine as the database? Does the Oracle user have OS read, write privileges on that directory? – APC Aug 29 '18 at 15:10
  • This folder is in my machine. The Oracle server is another machine – Carlota Aug 29 '18 at 15:32
  • 3
    @Carlota - "[A directory object specifies an alias for a directory **on the server file system**](https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sqlrf/CREATE-DIRECTORY.html)" (emphasis added), if can't be on the client (i.e. your local machine), unless the server can somehow see that anyway via a NFS mount or similar. PL/SQL runs inside the DB on the server, and can't see or access the client. – Alex Poole Aug 29 '18 at 15:37
  • [Possible duplicate](https://stackoverflow.com/q/2751113/266304); this question is at least trying to use a directory object, but APC's explanation applies here too? – Alex Poole Aug 29 '18 at 15:45

0 Answers0