public int noOfReservations(Date date) throws SQLException {
Statement stmt = conn.createStatement();
ResultSet resultSet = stmt.executeQuery("SELECT COUNT(*) "
+ "FROM RESERVATIONS WHERE RESERVATION_DATE = " + date);
// Get the number of rows from the result set
resultSet.next();
int rowCount = resultSet.getInt(1);
return rowCount;
}
It throws this error when I try to use it.
SEVERE: null
java.sql.SQLException: ORA-00932: inconsistent datatypes: expected DATE got NUMBER
I don't see how it could expect date and get number. Surely if I'm counting I want a number right?
Please help me to see the error of my ways. Thanks

New Topic/Question
Reply



MultiQuote




|