I am trying to enter null value if incoming value is less than 0 in Number field in Oracle table. I tried this way but its giving me invalid column index. Is there a better way to do this? Thank you
if (getNepID() > 0 )
{
cstmt.setInt(9,this.getNepID());
}else{
cstmt.setNull(9, java.sql.Types.NULL);
}
It is clearly issue with the number of parameters in the SQL Prepared statement.
Check the SQL statement that is being parsed and seee if indeed has 9 or more parameters.
Also change the setNull statement to
cstmt.setNull(9, java.sql.Types.INTEGER);