Timestamp truncates the trailing Zeros in nanoseconds
lijJun 25 2005 — edited Jun 29 2005I have a Database Timestamp(6) field as part of the Primary key. When the value is read from database(resultset.getTimestamp(colA)) and set to a java.sql.timestamp variable, it looses the trailing zero's of the nanosecond part.
Timestamp Column value(in DB)=20-Jun-05 10:30:22.695000 AM
TimeStamp tm= rs.getTimestamp(colA) returns only 20-Jun-05 10:30:22.695
So when i try to insert a detail record using the same value in the foreign key part, error occurs saying FK not found. eg: preparedstatment.setTimestamp(tm)
Im using PreparedStatement,binding parameters to insert into detail table. However if i convert to string and insert using the timestamp casting {ts ?} it works.
Currently im using JDK1.3 and ojdbc14.jar.
Why doesnt oracle take the value, what effect does the trailing zeros have.
Pleae Help
Lijith Chandy