to read text file using utl_file
673809Mar 31 2009 — edited Mar 31 2009I would like to read test_file_out.txt which is in c:\temp folder.
create or replace create or replace directory dir_temp as 'c:\temp';
grant read, write on directory dir_temp to system;
then when i execute the below code i get the error .
// to read text file using utl_file
DECLARE
FileIn UTL_FILE.FILE_TYPE;
v_sql VARCHAR2 (1000);
BEGIN
FileIn := UTL_FILE.FOPEN ('DIR_TEMP', 'test_file_out.txt', 'R');
UTL_FILE.PUT_LINE (FileIn, v_sql);
dbms_output.put_line(v_sql);
UTL_FILE.FCLOSE (FileIn);
END;
/
ERROR:
invalid file operation
i would like to use ult_file only and also can you let me know to read the text file and place its contents in tmp_emp table?