I am creating the Spring Boot
application with a PostgreSQL
database. and I am using JDBCTemplate
to perform DB operations. as per my requirement, I want a count
of the row
from CONTRACT_VIEW_2
table where the value of LICENSE_PLATE = "xxxxxx"
and ZONE_CODE is IN ("x","y","z")
but I am getting PSQL Exception.
I tried using MapSQLParameterSource but still, I facing the issue.
@Override
public Integer getAllZoneForLp(String lp,List<String> zones) {
MapSqlParameterSource zoneIds = new MapSqlParameterSource();
zoneIds.addValue("zoneIds",zones);
String sql = "select " +
"count(*) " +
"from contract_view_2 " +
"where license_plate = ? and zone_code IN (?)";
return jdbcTemplate.queryForObject(sql,Integer.class,lp,zoneIds);
}
I expect the row count
in the result but I am getting PSQL Exception
. I am attaching the image of the exception which I am getting.
Thanks in advance.