Search code examples
asp.netoracle-databaseclob

Will CLOB data be truncated when displayed in a SELECT query? If so, how can it be displayed?


I've got a Varchar2 field in my table which I want to convert to a CLOB. I am unsure whether the data would get truncated when selected. If so, what is the limit and does it depend on the database settings?

In my TOAD or SQLPLUS window it gets truncated but this may just be the environment settings. I'm not sure whether it would get truncated in my actual application (I can test this, but up to what size should I test?)

If it does get truncated, what's the best way to display the whole CLOB? There are other fields in my SELECT query, so I think I can't just loop through multiple rows. Is there any way out?

Thanks for your help.


Solution

  • In 10gR2 a CLOB can hold "(4 gigabytes - 1) * (database block size)", and the database block size is typically 8k.

    So a CLOB can, in theory, be a terabyte of data which would be beyond the scope of most machines to cope with.

    So the answer to "what size should I test" is whatever size you decide. I'd go with an order of magnitude larger than the limit I expect to process so if I'd was expecting a 5 MB value, I'd test with 50 MB. 50MB would be very big for text (though it may be appropriate if it was a log file of some sort).