This is the article I wrote a few years ago, I have not sent it. I will share it today. Everyone is from this example. This example, the memory and taking it understand
Import java.sql. *; import java.io. *; import oracle.jdbc.driver.racleResultset; import oracle.sql.clob;
Public Class TestoCleClob Implements Serializable {Public Static Void Main (String [] Args) {// Create Table Test (ID Integer, Content Clob); System.out.println ("------------- ------ INSERT ---------------- "); try {class.forname (" Oracle.jdbc.driver.Oracledriver); connection con = drivermanager.getConnection ("JDBC: Oracle: Thin: @fangm: 1521: LICSFC", "SFC", "SFC"); //con.setautocommit (False); // OK 1 String SQL = "Insert Into Test Values (1, EMPTY_CLOB () "; Statement stmt = con.createstatement (); resultSet = 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 ();} // ok 2 // string sql1 = "Insert Into test value) (2, EMPTY_CLOB ()) "; / / ResultSet RS3 = stmt.executeQuery (SQL1); String SQL12 = "INSERT INTO TEST VALUES (?,?)"; PreparedState pstmt1 = con.preparestatement (SQL12); pstmt1.setint (1, 2); PSTMT1.SETCLOB (2) , oracle.sql.clob.empty_lob ()); pstmt1.executeUpdate (); string SQLL2 = "SELECT Content from test where id = 2 for update"; resultset = stmt.executeQuery (SQLL2); if (rss2.next )) {CLOB clob = ((OracleResultSet) rss2) .getCLOB (1); clob.putString (1, "affffffffffdfdfdfdddddddffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdddfff");