I am working on insert a
string into a oracle Clob object, after I insert empty_clob() into the clob field, I try to lock it for further process:
//create table
test (id integer,content clob);
String sql="insert into testTable values(1,empty_clob())";
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(sql);
String sqll="select content from test where id=1 for update";
ResultSet rss=stmt.executeQuery(sqll);
if(rss.next()){
CLOB clob = ((OracleResultSet)rss).getCLOB(1);
clob.putString(1,"ddddddddddddddddddddddddddddddddddd");
sql="update test set content=? where id=1";
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setClob(1,clob);
pstmt.executeUpdate();
pstmt.close();
}