oracle clob insertion problem in spring
- by haluk
Hi, I want to insert CLOB value into my Oracle database and here is the what I could do. I got this exception while inserting operation "ORA-01461: can bind a LONG value only for insert into a LONG column". Would someone able to tell me what should I do? Thanks.
List<Object> listObjects = dao.selectAll("TABLE NAME", new XRowMapper());
String queryX = "INSERT INTO X (A,B,C,D,E,F) VALUES ?,?,?,?,?,XMLTYPE(?))";
OracleLobHandler lobHandler = new OracleLobHandler();
for(Object myObject : listObjects) {
dao.create(queryX, new Object[]{
((X)myObject).getA(),
((X)myObject).getB(),
new SqlLobValue (((X)myObject).getC(), lobHandler),
((X)myObject).getD(),
((X)myObject).getE(),
((X)myObject).getF()
},
new int[] {Types.VARCHAR,Types.VARCHAR,Types.CLOB,Types.VARCHAR,Types.VARCHAR,Types.VARCHAR});
}