This is the only READ_FILE procedure that compiled.
CREATE OR REPLACE PROCEDURE READ_FILE
(PI_DIRECTORY IN VARCHAR2,
PI_FILE_NAME IN VARCHAR2)
AS
V_File_handle UTL_FILE.FILE_TYPE;
V_FILE_Line VARCHAR2(906);
BEGIN
V_File_handle :=
UTL_FILE.FOPEN(PI_DIRECTORY, PI_FILE_NAME, 'R');
LOOP
UTL_FILE.GET_LINE( V_File_handle , v_file_line);
DBMS_OUTPUT.PUT_LINE(v_file_line);
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND
THEN UTL_FILE.FCLOSE( V_File_handle );
END;
Apparently, here is how to create a directory and set the permissions:
In order to create a directory you, (the database user), should have the following privileges:
CREATE ANY DIRECTORY.
CREATE OR REPLACE DIRECTORY test_files AS ‘E:\oracleWork’;
By default, you do get the READ WRITE privileges on this object. However, if you wish to assign a READ WRITE privilege to another user you can GRANT the necessary privileges as follows:
Bookmarks