oracle9i没用过,给你在8i里的用法参考.clob最多4G,不会字段长度不够
private final static String SAVE_DB =
"INSERT INTO news(newsID,content) VALUES(?,empty_clob())";
private final static String SAVE_DB2 = 
"SELECT content FROM news WHERE newsID=? FOR UPDATE";
Connection con = DBConnection.getConnection();
con.setAutoCommit(false);PreparedStatement pstm = con.prepareStatement(SAVE_DB);
....
pstm.executeUpdate();PreparedStatement pstm2 = con.prepareStatement(SAVE_DB2, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
pstm2.setInt(1, newsID);
rs = pstm2.executeQuery();
oracle.sql.CLOB clobContent = null;
if (rs.next())
{
clobContent = (oracle.sql.CLOB)rs.getClob(1);
}
Writer wr = clobContent.getCharacterOutputStream();
wr.write(content);
wr.flush();
wr.close();
con.commit();

解决方案 »

  1.   

    最多2g?不太记得了!插入不进去>4k的问题一般会出现在用sql-plus中,用程序我没遇到这个问题!
      

  2.   

    顶,问题急带解决
    只能用PreparedStatement处理clob吗?
    Statement可不可以啊
    The server encountered an internal error () that prevented it from fulfilling this request 这是什么错误
      

  3.   

    statement
    String 拼出来的sql语句>4k会出错的,插不进去,这样就只能insert <4k的。
      

  4.   

    但是我是用INSERT INTO news(newsID,content) VALUES(1,content1)这样的语句直接插入就行了啊.content1为新闻的内容.并不需要下面的语句啊..为什么呢?而且插入的时候,如果文章过长确实出现错误,但变短一些就没事了.