使用 dbms_lob. getlength()和 length()在 Oracle 中查找 blob 大小

我得到了同样的结果

select length(column_name) from table

select dbms_lob.getlength(column_name) from table

然而,答案是什么 这个问题似乎有利于使用 dbms_lob.getlength()

使用 dbms_lob.getlength()有什么好处吗?

如果它改变了答案,我知道所有的 BLOB 都是 .bmp映像(以前从未使用过 BLOB)。

262826 次浏览

length and dbms_lob.getlength return the number of characters when applied to a CLOB (Character LOB). When applied to a BLOB (Binary LOB), dbms_lob.getlength will return the number of bytes, which may differ from the number of characters in a multi-byte character set.

As the documentation doesn't specify what happens when you apply length on a BLOB, I would advise against using it in that case. If you want the number of bytes in a BLOB, use dbms_lob.getlength.