我想将 CLOB 值插入到我的 Oracle 数据库中,这就是我可以做的。插入操作“ORA-01461:只能绑定 LONG 值以插入 LONG 列”时出现此异常。有人能告诉我我该怎么做吗?谢谢。
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});
}