Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

to read text file using utl_file

673809Mar 31 2009 — edited Mar 31 2009
I 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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 28 2009
Added on Mar 31 2009
11 comments
2,811 views