【转】oracle.sql.Clob类型转换成String类型


/**
* oracle.sql.Clob类型转换成String类型
*
* @param clob
* @return
*/
public String clobToString(Clob clob) throws Exception {
if(null == clob || clob.length() == 0){
return null;
}
Reader is = clob.getCharacterStream();
// 得到流
BufferedReader br = new BufferedReader(is);
String str = br.readLine();
StringBuffer buffer = new StringBuffer();
while (str != null) {
buffer.append(str);
str = br.readLine();
}
String reString = buffer.toString();
return reString;
}

你可能感兴趣的:(数据库)