I have following privileges CREATE ANY DIRECTORY, read, write on directory DOCS to user_name
I am using oracle 10g on Windows.
I have first created the directory as
CREATE DIRECTORY DOCS AS 'C:\Documents and Settings\Owner\Desktop\file';
Directory created successfully.
Now when I tried to execute following code
DECLARE
l_file UTL_FILE.file_type;
l_location VARCHAR2(100) := 'DOCS';
l_filename VARCHAR2(100) := 'test.pdf';
l_text VARCHAR2(32767);
BEGIN
-- Open file.
l_file := UTL_FILE.fopen(l_location, l_filename, 'r', 32767);
-- Read and output first line.
UTL_FILE.get_line(l_file, l_text, 32767);
dbms_output.put_line('First Line: |' || l_text || '|');
-- Close the file.
UTL_FILE.fclose(l_file);
END;
I get these errors
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 475
ORA-29283: invalid file operation
ORA-06512: at line 8