UTL_FILE.FGETATTR returns 块大小为0

UTL_FILE.FGETATTR returns 0 for the block size

当我使用UTL_FILE.FGETATTR时,每次块大小returns0。我可以获得文件长度等,但块大小 returns 0。这可能是什么原因,我该如何解决? OS : Windows 10 数据库: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

我只是 post 大家都知道的答案,您可以将问题标记为已回答。或多或少是对我们在评论区谈论的一切的回忆。

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.

尽管针对 9i/10g 进行了预测和记录,但该问题在 12c、18c 和 19c 上也可重现。

Link to Support Note