What should be the minimum difference between the readbuffer variable size and the max_linesize(specified in UTL_FILE.FOPEN) so the code executes without ORA-29284 error.
For example below is my code:
set serveroutput on;
Declare
f UTL_FILE.FILE_TYPE;
r varchar2(1220);
begin
f:= UTL_FILE.FOPEN('XYZ_DIR', 'ABC.txt', 'R',max_linesize => 1222 );
UTL_FILE.GET_LINE(f,r);
UTL_FILE.FCLOSE(f);
dbms_output.put_line(r);
end;
When I execute the above mentioned code, I get ORA-29284 error. This error is due to the fetched linesize being larger than read buffer in this problem's context.
My file ABC.txt has multiple lines having individual length of 1221 characters. For this scenario getting the 29284 error is valid. But when I strip the line size in file to 1220 character, I still get the same error. If I strip the individual line size in file to 1218, my code works properly.
I want to know the reason why my code fails even though if I strip the individual line in file to 1220 character(same as read buffer) and why do I have to strip the length of lines to 1218 character?