oracle clob insertion problem in spring

Posted by haluk on Stack Overflow See other posts from Stack Overflow or by haluk
Published on 2010-05-05T21:15:15Z Indexed on 2010/05/05 21:18 UTC
Read the original article Hit count: 547

Filed under:
|
|
|

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});
}

© Stack Overflow or respective owner

Related posts about clob

Related posts about java