hi guys,
i'm working on this project that reads records in a text file located in a server directory and then inserts it into the table using UTL_FILE Utility. my problem is that i can't do the loop to read multiple records in the text file. so far here is what i got.
sample text file data:
----------------------------------
H00001XXXXX888888
D123458888555ENTJOHN DOE XXXX
D543219999777ENTALEX WALKER YYYY
D882760000880ENTKRIS BYRON ZZZZ
T00003WALKEN
=================================================
declare
l_directory varchar2(30) := 'ORADIR';
l_filename varchar2(30) := 'text_file.txt';
l_outfile utl_type.file_type;
l_buffer varchar2(32767);
begin
l_outfile := utl_file.fopen(l_directory, l_filename, 'r');
if utl_file.is_open(l_outfile) = false
then
l_outfile := utl_file.fopen(l_directory, l_filename, 'r');
end if;
--gets file from the text file...
utl_file.get_line(l_outfile, l_buffer);
--write data from text file
dbms_output.put_line(l_buffer);
--close file.
utl_file.fclose(l_outfile);
end;
=================================================
so the catch here is how am i going to implement the loop in order to read the multiple record with "D" at the beginning of the record. i've tried using loop but didn't work i only got 1 row of record. what appears with my dbms_output.put_line is "H00001XXXXX888888". i want to display all the text file so i could get the data from the text file and insert it in the table.
thanks guys :)