Get BLOB file size with automatic meaningful units

Just a quick reminder. Because this is not documented in the current API Docs at https://apex.oracle.com/api (as of Version 22.2).

If you want to display the file size of BLOB in Oracle APEX you can make use of the function APEX_UTIL.filesize_mask.

In Combination with dbms_lob.getlength it is easy to display any file size and no need to worry about the usage of KB, MB, GB, or TB.

apex_util.filesize_mask( dbms_lob.getlength( blob_column) )

--==============================================================================
-- Takes a file size in bytes and returns a rounded off size with trailing KB, MB, GB, or TB
-- Provides a more readable file size
-- Use FILESIZE format mask on numeric columns from within Classic and Interactive Reports
-- Null values will return null
-- KB, MB, GB, and TB are always english language strings
--
-- Example report format masks for interactive and classic reports
--     "FILESIZE"
--
-- Example SQL query syntax
--     "select apex_util.filesize_mask(8675309) from dual"
--==============================================================================
function filesize_mask (
    p_number       in number default null)
    return varchar2;
Result of apex_util.filesize_mask

http://www.grassroots-oracle.com/2014/07/returning-blob-file-size.html

https://www.oracle.com/webfolder/technetwork/de/community/apex/tipps/apex_util/index.html


Beitrag veröffentlicht

in

von

Schlagwörter: