日期:2014-05-16 浏览次数:20381 次
第一种: Clob clob = rs.getClob("remark");//java.sql.Clob String detailinfo = ""; if(clob != null){ detailinfo = clob.getSubString((long)1,(int)clob.length()); } 第二种: Clob clob = rs.getClob("remark");//java.sql.Clob int i = 0; if(clob != null){ InputStream input = clob.getAsciiStream(); int len = (int)clob.length(); byte by[] = new byte[len]; while(-1 != (i = input.read(by, 0, by.length))){ input.read(by, 0, i); } detailinfo = new String(by, "utf-8"); } 第三种: Clob clob = rs.getClob("remark");//java.sql.Clob String value=""; String line=""; if(clob!=null){ Reader reader=((oracle.sql.CLOB)clob).getCharacterStream(); BufferedReader br=new BufferedReader(reader); while((line=br.readLine())!=null) { value += line + "\r\n"; } }