Enter null value in number field in oracle

10,442

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);

Share:
10,442
Jack
Author by

Jack

Updated on June 14, 2022

Comments

  • Jack
    Jack almost 2 years

    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);
    }