Re: Date types in where clause of PreparedStatement
От | Gregory Wood |
---|---|
Тема | Re: Date types in where clause of PreparedStatement |
Дата | |
Msg-id | 003801c09d46$d1abc260$7889ffcc@comstock.com обсуждение исходный текст |
Ответ на | Date types in where clause of PreparedStatement ("Ian deSouza" <iandesouza@earthlink.net>) |
Список | pgsql-general |
Using a DateTime value in a WHERE clause is not a good idea for the reason that DateTimes are usually represented by a floating point value in the database itself. And since floating point numbers are prone to rounding errors, they don't make for a good unique identifier. If you have to use dates in your WHERE clauses, try doing a BETWEEN. Greg ----- Original Message ----- From: "Ian deSouza" <iandesouza@earthlink.net> To: <pgsql-general@postgresql.org> Sent: Sunday, February 18, 2001 11:17 AM Subject: Date types in where clause of PreparedStatement > Can anybody show any reason why the code using a prepared statement with a > where clause using a date won't find any records on PostgreSQL but WILL work > using Access and the jdbc-odbc bridge? > > ie. > > SQL: select > OrderID,CustomerID,EmployeeID,OrderDate,RequiredDate,ShippedDate,ShipVia,Fre > ight,ShipName,ShipAddress,ShipCity,ShipRegion,ShipPostalCode,ShipCountry > from Orders where OrderDate = ? > Setting value: OrderDate 1996-07-05 00:00:00.0 > > It does not cause an exception, but fails to retrieve anything with > PostgreSQL yet works and retrieves the right record with Access. > > I further verified that a record does exist with the PostreSQL database. > > > >
В списке pgsql-general по дате отправления: