tags:

views:

257

answers:

1

Hi all,

How do i get size in bytes of a CLOB column in Oracle?

LENGTH and DBMS_LOB.getLength both return number of characters used in the CLOB, but i need to know how many bytes are used (i'm dealing with multibyte charactersets).

thx,

Rag

A: 

After some thinking i came up with this solution:

 LENGTHB(TO_CHAR(SUBSTR(<CLOB-Column>,1,4000)))

SUBSTR returns only the first 4000 characters (max string size)

TO_CHAR converts from CLOB to VARCHAR2

LENGTHB returns the length in Bytes used by the string.

Peter

rag