Does utl_file fseek give an error with a large absolute offset?

I need to make a program that will use fseek to read data from the pirticular position. I have to read data line by line, and in a pirticular line I have to use fseek to read data. But when I use fseek and absolute_offset is large (a little smaller than the file size), it throws this error

ORA-29284: file read error
ORA-06512: at "SYS.UTL_FILE", line 219
ORA-06512: at "SYS.UTL_FILE", line 1145
ORA-06512: at line 15"

but with a small absolute_offset value, such as 4000, it works correctly and selects the data. Line number 15 where I use fseek giving an error.

DECLARE
  lv_utl UTL_FILE.FILE_TYPE;
  v_buff VARCHAR2(2000);
  l_exists boolean;
  l_block VARCHAR2(2000);
  l_file_length number;
  v_line varchar2(5000);
BEGIN
  UTL_FILE.fgetattr('/d04/data/edi/inbound','POO0001.dat',l_exists,l_file_length,l_block);
  lv_utl := UTL_FILE.FOPEN('/d04/data/edi/inbound','POO0001.dat','R');
  --utl_file.get_line(lv_utl,v_line,50);
  --dbms_output.put_line(v_line);
  --l_file_length:=length();
  dbms_output.put_line(l_file_length);
  utl_file.fseek(lv_utl,1261061);
  utl_file.get_line(lv_utl,v_buff,100);
  dbms_output.put_line(v_buff);
  --lv_msg_txt := 'empno ename job manager hiredate commission salary department_no';
  --UTL_FILE.PUT_LINE(lv_utl,lv_msg_txt);
  --UTL_FILE.PUT_LINE(lv_utl,'------------------------------------------------------------------------------------');
  --UTL_FILE.PUT_LINE(lv_utl,' ');
  --UTL_FILE.FCLOSE(lv_utl);
END;
+3
source share
2 answers

, . , lengh FOPEN, .

lv_utl := UTL_FILE.FOPEN('/d04/data/edi/inbound','POO0001.dat','R');

,

lv_utl := UTL_FILE.FOPEN('/d04/data/edi/inbound','POO0001.dat','R',5000);

. , .

, DBMS_LOB, BFILE.

+1
0

Source: https://habr.com/ru/post/1778300/


All Articles