may be this will help
declare
fileptr utl_file.file_type;
buffer varchar2(2048);
line_num number(10):=0;
loc_no integer;
begin
fileptr:=utl_file.fopen('F
loop
line_num:=line_num+1;
utl_file.get_line(fileptr,
dbms_output.put_line(line_
end loop;
exception
when no_data_found then
utl_file.fclose(fileptr);
dbms_output.put_line('Numb
when value_error then
dbms_output.put_line('valu
raise_application_error(-2
when utl_file.invalid_path then
dbms_output.put_line('inva
raise_application_error(-2
when utl_file.invalid_mode then
dbms_output.put_line('inva
raise_application_error(-2
when utl_file.invalid_filehandl
dbms_output.put_line('inva
raise_application_error(-2
when utl_file.invalid_operation
dbms_output.put_line('inva
raise_application_error(-2
when utl_file.read_error then
dbms_output.put_line('read
raise_application_error(-2
when utl_file.write_error then
dbms_output.put_line('writ
raise_application_error(-2
when utl_file.internal_error then
dbms_output.put_line('inte
raise_application_error(-2
when others then
dbms_output.put_line('un-h
raise_application_error(-2
end;
utl_file.get_line function will retrive all text in the current line
Main Topics
Browse All Topics





by: MergenPosted on 2003-04-26 at 03:45:53ID: 8400455
You should process NO_DATA_FOUND exception.
'H:\oracle 81 \File','test5.txt','R');
ffer);
Some example:
DECLARE
file_name UTL_FILE.FILE_TYPE;
strbuffer VARCHAR2(100);
BEGIN
//open file
file_name:=UTL_FILE.FOPEN(
//process file
LOOP
UTL_FILE.GET_LINE (file_name, strbuffer);
DBMS_OUTPUT.PUT_LINE(strbu
END LOOP;
//if end of line not action
EXCEPTION WHEN NO_DATA_FOUND THEN NULL;
END;
/