Skip to Main Content
  • Questions
  • Question about utl_file.fgetattr and blocksize have problem

Breadcrumb

May 4th

Question and Answer

Connor McDonald

Thanks for the question, Chotipong.

Asked: February 12, 2016 - 10:42 am UTC

Last updated: February 12, 2016 - 10:55 am UTC

Version: 11g

Viewed 1000+ times

You Asked

Dear All

I have question about below query every time when I execute Block Size always display 4096 like below result, please help me to find some solution to get file size from server

DECLARE
ex BOOLEAN;
flen NUMBER;
bsize NUMBER(9,2);
BEGIN
utl_file.fgetattr('PAYG', 'FBSS_OLT_INFO_20160212.dat', ex, flen, bsize);
IF ex THEN
dbms_output.put_line('File Exists');
ELSE
dbms_output.put_line('File Does Not Exist');
END IF;
dbms_output.put_line('File Length: ' || TO_CHAR(flen));
dbms_output.put_line('Block Size: ' || TO_CHAR(bsize));
END fgetattr;

Result

File Exists
File Length: 6375
Block Size: 4096 <<<<<<< always display 4096

Best Regards
Aum

and Connor said...

The size of the *file* is in 'flen'.

The block size is the underlying block size of the file system that the file is sitting on. It is *not* the number of blocks that the file consumes, but the size of the allocation unit for *all* files on the file system.

Hope this helps.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Thank you very much for your answer

Chotipong Sansern, February 15, 2016 - 10:14 am UTC


More to Explore

DBMS_OUTPUT

More on PL/SQL routine DBMS_OUTPUT here