SQL dbms_lob.getlength() 与 length() 在 oracle 中查找 blob 大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2373138/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
dbms_lob.getlength() vs. length() to find blob size in oracle
提问by Vincent Malgrat
I'm getting the same results from
我得到了相同的结果
select length(column_name) from table
as
作为
select dbms_lob.getlength(column_name) from table
select dbms_lob.getlength(column_name) from table
However, the answers to
this questionseem to favor using dbms_lob.getlength()
.
然而,这个问题的答案
似乎倾向于使用dbms_lob.getlength()
.
Is there any benefit to using dbms_lob.getlength()
?
使用有什么好处dbms_lob.getlength()
吗?
If it changes the answer, I know all of the blobs are .bmp images (never worked with blobs before).
如果它改变了答案,我知道所有的 blob 都是 .bmp 图像(以前从未使用过 blob)。
回答by Vincent Malgrat
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.
length
并dbms_lob.getlength
返回应用于CLOB(字符 LOB)时的字符数。当应用于BLOB(二进制 LOB)时,dbms_lob.getlength
将返回字节数,这可能与多字节字符集中的字符数不同。
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
.
由于文档没有具体说明申请length
BLOB时会发生什么,我建议不要在这种情况下使用它。如果您想要 BLOB 中的字节数,请使用dbms_lob.getlength
.