dbms_lob.getlength() vs. length() to find blob size in oracle

家住魔仙堡 提交于 2019-12-18 10:16:28

问题


I'm getting the same results from

select length(column_name) from table

as

select dbms_lob.getlength(column_name) from table

However, the answers to this question seem to favor using dbms_lob.getlength().

Is there any benefit to using dbms_lob.getlength()?

If it changes the answer, I know all of the blobs are .bmp images (never worked with blobs before).


回答1:


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.



来源:https://stackoverflow.com/questions/2373138/dbms-lob-getlength-vs-length-to-find-blob-size-in-oracle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!