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
  • 22,203
  • 13
  • 58
  • 75
David Silva
  • 1,939
  • 7
  • 28
  • 60

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,665
  • 12
  • 47
  • 70