0

This code:

ids = "1245, 4526, 7689, 8001";
jdbcTemplate.update("DELETE FROM my_table WHERE id IN (?)", new Object[] { ids });

throws the following exception:

(...) nested exception is java.sql.SQLSyntaxErrorException: ORA-01722: invalid number

How do I pass the list of IDs to the above sql statement?

Mathias Müller
  • 21,291
  • 13
  • 56
  • 74
David Silva
  • 1,819
  • 7
  • 25
  • 58

1 Answers1

1

Your query is wrong.You can't pass list to single arguement.

Try this.

jdbcTemplate.update("DELETE FROM my_table WHERE id IN (?,?,?,?)", new Object[] { 1245, 4526, 7689, 8001});
Shoaib Chikate
  • 8,177
  • 12
  • 45
  • 67