我通常使用lobHandler + JdbcTemplate + PreparedStatementSetter三元组将我的Clob插入到数据库中,正如我在http://www.java2s.com/Code/Java/Spring/InsertClobData.htm上看到的那样
我的问题是如何使用NamedParameterJdbcTemplate执行此操作?它没有接受神秘的PreparedStatementSetter接口作为参数的方法.
我的问题是:ORA-01704: string literal too long在使用CLOBs 插入(或在查询中执行任何操作)时,如何解决错误?
我想要这样的查询:
INSERT ALL
INTO mytable VALUES ('clob1')
INTO mytable VALUES ('clob2') --some of these clobs are more than 4000 characters...
INTO mytable VALUES ('clob3')
SELECT * FROM dual;
Run Code Online (Sandbox Code Playgroud)
当我尝试使用实际值时,虽然我ORA-01704: string literal too long回来了.这很明显,但是如何插入clobs(或者使用clob执行任何语句)?
我试过看过这个问题,但我认为它没有我想要的东西.我拥有的clob在a中List<String>,我遍历它们来做出声明.我的代码如下:
private void insertQueries(String tempTableName) throws FileNotFoundException, DataException, SQLException, IOException {
String preQuery = " into " + tempTableName + " values ('";
String postQuery = "')" + StringHelper.newline;
StringBuilder inserts …Run Code Online (Sandbox Code Playgroud)