When I use UTL_FILE.FGETATTR, the block size returns 0 each time. I can get file length etc, but block size returns 0. What can be the reason for that and how can I solve this? OS : Windows 10 DB : 19c
DECLARE
v_fexists BOOLEAN;
v_file_length NUMBER;
v_block_size BINARY_INTEGER;
BEGIN
UTL_FILE.FGETATTR ('TEST_DIR','temp file.txt',v_fexists,v_file_length,v_block_size);
IF v_fexists THEN
DBMS_OUTPUT.PUT_LINE('The file exists');
DBMS_OUTPUT.PUT_LINE('Its length is :'||v_file_length);
DBMS_OUTPUT.PUT_LINE('Its block size is :'||v_block_size);
ELSE
DBMS_OUTPUT.PUT_LINE('The file does not exist!');
END IF;
END;
PL/SQL procedure successfully completed.
The file exists
Its length is :2794
Its block size is :0
I just post the answer that everybody is aware and you can mark the question as answered. It is more or less a recollection of everything we've been talking about on the comments section.
On Windows platforms, UTL_FILE.FGETATTR procedure returns 0 instead of the correct block size even if the file exists. Windows platform does not provide any system sub-routine to obtain the filesystem I/O block size, as a result it returns 0, which is the expected behaviour.
Although it is predicted and documented for 9i/10g, the problem is reproducible on 12c, 18c and 19c as well.