I've tried this
public void deleteRegisterByFileEx(String fileCode, int batchSize) {
String sql = "DELETE FROM TB_REGISTRO WHERE FILE_ID = ? LIMIT ?";
int[] argTypes = { Types.VARCHAR, Types.INTEGER };
List<Object[]> batchArgs = new ArrayList<>();
batchArgs.add(new Object[] { fileCode, batchSize });
template.batchUpdate(sql, batchArgs, argTypes);
}
and also this
String sql = "DELETE TOP (?) FROM TB_REGISTRO WHERE FILE_ID = ?";
int[] argTypes = { Types.INTEGER, Types.VARCHAR };
List<Object[]> batchArgs = new ArrayList<>();
batchArgs.add(new Object[] { batchSize, fileCode });
template.batchUpdate(sql, batchArgs, argTypes);
Neither of those worked, and i don't really know why, the only error message is ORA-00933: SQL command not properly ended
One approach would be like this:
delete tb_registro
where rowid in
( select rowid from tb_registro
fetch first 3 rows only );
An order by
clause before fetch first
would make the result more predictable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.