我试了下:shield2008 兄的方法很好用阿~import java.io.Writer;(jdbc的驱动最好是8.17版本以上)写入
sql = new StringBuffer();
sql.append("Insert into Notice (noticeId,content,……) Values (1,EMPTY_CLOB(),……)");
prstmt = conn.prepareStatement(sql.toString());
prstmt.execute();sql = new StringBuffer();
rs = null;
String content = "asdfasdfasdfasdfadf";
sql.append("Select content From Notice where …… for update");
prstmt = conn.prepareStatement(sql.toString());
rs = prstmt.executeQuery();
if (rs.next()) {
oracle.sql.CLOB clob = (oracle.sql.CLOB) rs.getClob(1);
Writer writer = clob.getCharacterOutputStream();
writer.write(content );
writer.flush();
writer.close();
}读取
oracle.sql.CLOB clob = (oracle.sql.CLOB) rs.getClob("Content");
Long length = new Long(clob.length());
String content = clob.getSubString(1, length.intValue());
sql = new StringBuffer();
sql.append("Insert into Notice (noticeId,content,……) Values (1,EMPTY_CLOB(),……)");
prstmt = conn.prepareStatement(sql.toString());
prstmt.execute();sql = new StringBuffer();
rs = null;
String content = "asdfasdfasdfasdfadf";
sql.append("Select content From Notice where …… for update");
prstmt = conn.prepareStatement(sql.toString());
rs = prstmt.executeQuery();
if (rs.next()) {
oracle.sql.CLOB clob = (oracle.sql.CLOB) rs.getClob(1);
Writer writer = clob.getCharacterOutputStream();
writer.write(content );
writer.flush();
writer.close();
}读取
oracle.sql.CLOB clob = (oracle.sql.CLOB) rs.getClob("Content");
Long length = new Long(clob.length());
String content = clob.getSubString(1, length.intValue());
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货