Open ComLock opened 7 years ago
Perhaps this: SELECT CAST(ClobColumnName AS VARCHAR(50)) AS ClobColumnName ;
Found here: https://stackoverflow.com/questions/15377158/how-to-show-clob-type-in-a-select-in-sql-server
The reason I need the CLOB in the first place is the column exceeds the limits.
So if I do CAST(ClobColumnName AS VARCHAR(4000)) I may loose some data. So getClob() would be better.
As a workaround I could "split" the column into 2 or more. Which would allow me 8K, 12K and so on. But It may slow the query, which is already really slow.
ORACLE Datatype Limits https://docs.oracle.com/cd/B28359_01/server.111/b28320/limits001.htm#i287903
No luck with the workaround so far:
ERROR com.enonic.xp.resource.ResourceProblemException: Exception thrown while attempting to traverse the result set
I guess if I cast to varchar 2400 (6407-4000=2407) I might be in luck.
Or change the buffer size if possible.
Trying
select dbms_lob.substr(ClobColumnName, 4000, 1) as part1,
dbms_lob.substr(ClobColumnName, 4000, 4001) as part2
now.
That worked :) So I have a workaround.
I have a column which is a CLOB.
In the sql lib query result I only get a reference to the CLOB not the actual characters.
This article hints at using getClob() to get the actual characters: https://docs.oracle.com/cd/A97335_02/apps.102/a83724/oralob2.htm
I could not find anything in the code https://github.com/enonic/lib-sql/search?utf8=%E2%9C%93&q=getClob&type=
I sorta need this (or other ways of achieving the same result) to finish up a certain project...