JDBC更新CLOB字段

更新CLOB字段:
sqldel.append("select rt_result from p2004_pax_from_q where id='").append(pnr.getId()).append( "' ");
Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE ,ResultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery(sqldel.toString());
while(rs.next())
{
    CLOB clob=(CLOB)rs.getClob( "rt_result");
    clob.putChars(clob.length()+1, (pnr.getRtResult()==null ?"no" :pnr.getRtResult()).toCharArray());
    rs.updateRow();
}
rs.close();
stmt.close();

如果是新增记录则在insert是讲CLOB字段的值设为:empty_clob()
然后再用上述方法更新

你可能感兴趣的:(JDBC更新CLOB字段)