1、数据中用CLOB存储大字符串DETAIL
2、关键java代码
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
String sqlText="";
try {
// 建立JDBC连接
connection = .....;
statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs = statement.executeQuery(sqlText);
while (rs.next()) {
// 获取详细信息大字段
oracle.sql.CLOB clobDetail = (oracle.sql.CLOB) rs.getClob("DETAIL");
String detail = null;
if (clobDetail != null) {
// 大字段不为空则取值
BufferedReader in = new BufferedReader(clobDetail.getCharacterStream());
StringWriter out = new StringWriter();
int c;
try {
while ((c = in.read()) != -1) {
out.write(c);
}
detail = out.toString();
in.close();
out.close();
} catch (IOException ex1) {
log.err(logName, "get the detail clob column I/O error:" + ex1);
}
} else {
// 大字段为空则moId为空
detail = "";
}
}
} catch (SQLException ex) {
log.err(logName, "queryOperationLogNextChunk SQLException:" + ex);
} finally {
// 释放JDBC资源
}