//第一步
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字段
SQL操作与CLOB字段保存
最新推荐文章于 2024-09-04 09:53:00 发布
本文详细介绍了如何使用SQL语句插入并更新CLOB类型的数据,包括设置连接属性、执行SQL查询、获取并操作CLOB值,以及最终保存到数据库的过程。
1543

被折叠的 条评论
为什么被折叠?



