简体   繁体   中英

How can I convert CLOB datatype into VARCHAR? or just to minimize the CLOB content because I am encounteringa JAVA heap error

I need to use a column that has CLOB datatype but it always lead me to JAVA Heap error. How can I convert the CLOB to VARCHAR? or how can I minimize the character count of the CLOB datatype?

I have only tried using this: select table.columnname (col, 100) from table

When you read data from a LOB datatype your JAVA program gets a bytestream and needs to read it into a byte[] variable as long as there is more data coming from the server.

Now, LOBs generally are there to allow for large amounts of data and your client program needs to handle those.

One way for that could be to increase the Java heap size in your virtual machine (check the documentation of your JAVA VM for that - it's typically some -X parameter).

Another option is to check for the length() of the LOB value before you read it from the data based and process the data in chunks. Eg if you only want to preview some data of the LOB columns, then only read the first 100KB or so and stop reading afterwards. SAP HANA Studio does this for example.

Either way, your application needs to handle the amount of data if it wants to use LOB data types.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM