My question is: How to get around error ORA-01704: string literal too long when pasting (or doing something in queries) using CLOB s?
I want to have a query like this:
INSERT ALL INTO mytable VALUES ('clob1') INTO mytable VALUES ('clob2')
When I try to use it with actual values, I get ORA-01704: string literal too long back. This is pretty obvious, but how can I embed clobs (or even execute some kind of statement with clob)?
I tried looking at the question , but I do not think that I have what I am looking for. The bugs that I have are in the List<String> , and I repeat them to make a statement. My code is as follows:
private void insertQueries(String tempTableName) throws FileNotFoundException, DataException, SQLException, IOException { String preQuery = " into " + tempTableName + " values ('"; String postQuery = "')" + StringHelper.newline; StringBuilder inserts = new StringBuilder("insert all" + StringHelper.newline); List<String> readQueries = getDomoQueries(); for (String query : readQueries) { inserts.append(preQuery).append(query).append(postQuery); } inserts.append("select * from dual;"); DatabaseController.getInstance().executeQuery(databaseConnectionURL, inserts.toString());
}
public ResultSet executeQuery(String connection, String query) throws DataException, SQLException { Connection conn = ConnectionPool.getInstance().get(connection); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(query); conn.commit(); ConnectionPool.getInstance().release(conn); return rs; }
java oracle insert jdbc clob
kentcdodds May 23 '12 at 20:42 2012-05-23 20:42
source share