//第一步
sql = "insert into BBS_DETAIL(AnnounceID,Body) values (4,EMPTY_CLOB() );";
conn.setAutoCommit(false);
stmt = conn.createStatement();
stmt.executeUpdate(sqlstr);
//第二步
String sqll = "select Body from BBS_DETAIL where AnnounceID = 4 for update";
ResultSet rss=stmt.executeQuery(sqll);
CLOB clob =null;
if(rss.next()){
clob= ((OracleResultSet)rss).getCLOB(1);
}
clob.putString(1, clobValue);
//第三步
///保存clob字段 Bruce.Ran
String csql="update BBS_DETAIL set Body =? where AnnounceID = 4 ";
PreparedStatement pstmt=conn.prepareStatement(csql);
pstmt.setClob(1,clob);
pstmt.executeUpdate();
conn.commit();
stmt.close();
pstmt.close();
Oracle存Clob字段
最新推荐文章于 2021-04-08 20:22:11 发布