I'm actually trying to execute delete from mytable where CreationDate < now() - interval '5 month'
I want to pass a parameter 5
to ?
public static final StringBuilder SQL_MY_Query= new StringBuilder(
"delete from mytable where CreationDate < now() - interval '? month'");
ps = con.prepareStatement(SQL_MY_Query.toString());
ps.setInt(1, 5);
I'm getting an error Sql Exception org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0.
How do we fix this?