下面是代码! stat=conn.getConnection().createStatement(); rs_set=stat.executeQuery(sqlStr); rsmd=rs_set.getMetaData(); if (!rs_set.next()) return null; if (rsmd.getColumnType(1)!=java.sql.Types.CLOB) return rs_set.getString(1); String tmpstr=""; oracle.sql.CLOB clob=(oracle.sql.CLOB)rs_set.getObject(1); if (clob==null) return null; long cloblen=(long)clob.length(); int clobPerReadLen = 1024; int times= (int)(cloblen/clobPerReadLen); int len = (int)(cloblen%clobPerReadLen); tmpstr = clob.getSubString(1,len); for (int li_i=1 ;li_i<=times ;li_i++ ) tmpstr+=clob.getSubString(len+1+(li_i-1)*clobPerReadLen,clobPerReadLen); return tmpstr;
rs_set=stat.executeQuery(sqlStr);
rsmd=rs_set.getMetaData();
if (!rs_set.next()) return null; if (rsmd.getColumnType(1)!=java.sql.Types.CLOB)
return rs_set.getString(1);
String tmpstr="";
oracle.sql.CLOB clob=(oracle.sql.CLOB)rs_set.getObject(1);
if (clob==null) return null;
long cloblen=(long)clob.length();
int clobPerReadLen = 1024;
int times= (int)(cloblen/clobPerReadLen);
int len = (int)(cloblen%clobPerReadLen);
tmpstr = clob.getSubString(1,len);
for (int li_i=1 ;li_i<=times ;li_i++ )
tmpstr+=clob.getSubString(len+1+(li_i-1)*clobPerReadLen,clobPerReadLen);
return tmpstr;