oarcle wm_concat 值过长解决--使用 clob

sql 语句替换 :
select XMLAGG(XMLELEMENT(a, WSODETAILPALINCD || ',')).EXTRACT('//text()').getclobval() as wdpcdss from tablename a

// java 中 用java.sql.Clob 接收

//clob 转字符串
public static String ClobToString(Clob clob)  {
String reString = "";
try{
Reader is = clob.getCharacterStream();// 得到流
BufferedReader br = new BufferedReader(is);
String s = br.readLine();
StringBuffer sb = new StringBuffer();
while (s != null) {// 执行循环将字符串全部取出付值给StringBuffer由StringBuffer转成STRING
sb.append(s);
s = br.readLine();
}
reString = sb.toString();
}catch (Exception e){

}
return reString;
}
posted @ 2019-12-07 14:08  冬天不眠  阅读(435)  评论(0编辑  收藏  举报