clob 转为 String
oracle方法
select t.*,dbms_lob.substr(t.list) from risk_td_custom_list t for update
缺点:
clob类型的数据,使用dbms_lob.substr将其转换成varchar2 可是只能获取部分数据 varchar2(32767)
java方法
public String clobToString(Clob clob) throws SQLException, IOException{ java.io.Reader iReader = clob.getCharacterStream(); BufferedReader br = new BufferedReader(iReader); String s = br.readLine(); StringBuffer sb = new StringBuffer(); while (sb !=null){ sb.append(s); s= br.readLine(); } return br.toString(); }