tags:

views:

878

answers:

1

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_log.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).

+2  A: 

Hi Luke,

length and dbms_log.getlength return the number of characters when applied to a CLOB (Character LOB). When applied to a BLOB (Binary LOB), dbms_log.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_log.getlength.

Vincent Malgrat
Or if you know you are working with BLOBs and not CLOBs or NCLOBs use lengthb(BLOB) to get the number of bytes in the BLOB.
Janek Bogucki