I am trying to create directory is SQL Developer and create a simple text file there using this code :
CREATE DIRECTORY ABC AS '/abc';
DECLARE
fileHandler UTL_FILE.FILE_TYPE;
BEGIN
fileHandler := UTL_FILE.FOPEN('ABC', 'test_file.txt', 'W');
UTL_FILE.PUTF(fileHandler, 'Writing to a file\n');
UTL_FILE.FCLOSE(fileHandler);
END;
But it ends up with that Error
29283. 00000 - "invalid file operation"
*Cause: An attempt was made to read from a file or directory that does
not exist, or file or directory access was denied by the
operating system.
*Action: Verify file and directory access privileges on the file system,
and if reading, verify that the file exists.
In SQL developer the directory variable is created and visible
So, my question is Does that piece of code suppose to create directory by itself or do i have to create it manually? (I don't have access to the servers file system)
FOPENwill create the file if it doesn't exist. However, it can only create files in directories where it has write access. Have you tried providing the complete file path?dba_directories