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?
values (TUR1HV01.SEQ_CP_GOR_MODEL.nextval, ?)
should work.