具体函数如下:
//clob 转换 String (传入 clob 类型的 obj 对象)
public static String getClob2String(Object obj) {
String str = "";
try {
CLOB clob = (CLOB) obj;
if (clob == null || clob.length() == 0) {
str = "";
} else {
long clen = clob.length();
char clobArray[] = new char[(int) clen];
int readednum = clob.getChars(1, (int) clen, clobArray);
StringBuffer sb = new StringBuffer();
sb.append(clobArray);
str = sb.toString();
}
} catch (SQLException e) {
e.printStackTrace();
}
return str;
}