英文:
JdbcTemplate batchUpdate is it possible to use a sequence in the insert?
问题
在batchUpdate
方法的插入操作中使用序列是否可能?
我没有找到有关这个主题的任何信息。
jdbcTemplate.batchUpdate(
"INSERT INTO TUR1HV01.UR1_CP_GOR (id, GOR_NAME) values (select TUR1HV01.SEQ_CP_GOR_MODEL.nextval from dual, ?)",
gorList,
10000,
(ps, argument) -> {
ps.setString(1, argument.getGorName());
});
异常:
Caused by: Error : 936, Position : 56, Sql = INSERT INTO TUR1HV01.UR1_CP_GOR (id, GOR_NAME) values (select TUR1HV01.SEQ_CP_GOR_MODEL.nextval from dual, :1 ), OriginalSql = INSERT INTO TUR1HV01.UR1_CP_GOR (id, GOR_NAME) values (select TUR1HV01.SEQ_CP_GOR_MODEL.nextval from dual, ?), Error Msg = ORA-00936: missing expression
我应该使用触发器来代替吗?
英文:
Is it possible to use a sequence in the insert of a call to the batchUpdate
method?
I've not found anything on this subject.
jdbcTemplate.batchUpdate(
"INSERT INTO TUR1HV01.UR1_CP_GOR (id, GOR_NAME) values (select TUR1HV01.SEQ_CP_GOR_MODEL.nextval from dual, ?)",
gorList,
10000,
(ps, argument) -> {
ps.setString(1, argument.getGorName());
});
Exception:
Caused by: Error : 936, Position : 56, Sql = INSERT INTO TUR1HV01.UR1_CP_GOR (id, GOR_NAME) values (select TUR1HV01.SEQ_CP_GOR_MODEL.nextval from dual, :1 ), OriginalSql = INSERT INTO TUR1HV01.UR1_CP_GOR (id, GOR_NAME) values (select TUR1HV01.SEQ_CP_GOR_MODEL.nextval from dual, ?), Error Msg = ORA-00936: missing expression
shlould I use a trigger insetad?
答案1
得分: 1
values (TUR1HV01.SEQ_CP_GOR_MODEL.nextval, ?) should work.
英文:
values (TUR1HV01.SEQ_CP_GOR_MODEL.nextval, ?)
should work.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论