环境:oracle 11g、spring-jdbc-3.2.2-RELEASE.jar、JDK 1.7、Oracle UCP 驱动程序。
我有一个存储过程,它将记录插入到具有 CLOB 列的表中。 SP 在其他 IN 和 OUT 参数中具有 CLOB 输入参数。我的Java代码使用Spring StoredProcedure来调用存储过程:
public class MyClass extends StoredProcedure {
public MyClass(){
.....
declareParameter(new SqlParameter("content", Types.CLOB));
.....
}
public void insert(){
HashMap<String,Object> params = new HashMap<String, Object>(37);
String bigContent = ....; // which contains ASCII chars in my test
....
params.put("content", new SqlLobValue(bigContent));
....
execute(params);
}
}
如果 bigContent 的字符数
我想使用 SP,因为它可以做很多其他事情,并且比单独调用多个 SQL 插入、更新和查询语句更有效。
有人知道如何让它与 SP 一起工作吗?或者,如果 bigContent 具有 > 32K 字符,这就是我必须以不同方式处理它的限制?
这取决于您的 Oracle 版本:
- SetBigStringTryClob财产给
true
在你的DriverManager
.
- >= 10.1:您可以使用
OraclePreparedStatement.setStringForClob
doc here http://docs.oracle.com/cd/E11882_01/appdev.112/e13995/oracle/jdbc/OraclePreparedStatement.html.
Also, 本文 http://fahdshariff.blogspot.ca/2008/07/big-strings-and-oracle-clobs.html可能会帮助你。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)