/** * 更新clob数据类型的值 * @param columnName * @param lids * @param para * @return */ public static boolean executeClobSQL(String columnName,String lids,String para){ boolean flag = false; Connection connection = null; PreparedStatement pstmt = null; ResultSet rs = null; Writer outStream = null; try { connection = GsUtil.getConnection(); //for update 锁定数据 pstmt = connection.prepareStatement(" select "+columnName+" from g3_log_info where lids='"+lids+"' for update"); rs = pstmt.executeQuery(); while(rs.next()){ oracle.sql.CLOB clobparas = (oracle.sql.CLOB) rs.getClob(1); outStream = clobparas.getCharacterOutputStream(); //data是传入的字符串,定义:String data char[] cp = para.toCharArray(); outStream.write(cp, 0, cp.length); } outStream.flush(); outStream.close(); connection.commit(); } catch (Exception e) { e.printStackTrace(); }finally{ GsUtil.closeConnection(rs, pstmt, connection); } return flag; }