posted 13 years ago
My program is as follows
dbStatement.executeUpdate("create table employee(id INTEGER constraint employee_pk primary key not null, " +
"name VARCHAR(50), salary float)");
dbStatement.executeUpdate("insert into employee values(1, 'A', 30000)");
dbStatement.executeUpdate("insert into employee values (2, 'B', 50000)");
dbStatement.executeUpdate("insert into employee values (3, 'C', 20000)");
dbStatement.executeUpdate("insert into employee values (4, 'D', 40000)");
PreparedStatement preparedStatement = dbConnection.prepareStatement("update employee set salary = ? where salary <= ");
preparedStatement.setFloat(1, 65000);
preparedStatement.setFloat(2, 40000);
preparedStatement.executeUpdate();
preparedStatement.close();
dbStatement.close();
dbConnection.close();
And I am getting the error --
Invalid column index at the line --- preparedStatement.setFloat(2, 40000);
Could somebody please help me out