I have the following problem:
I use JDBC
to connect to Oracle. And I call rs.getTimestamp(index)
to get a date field.
When I run the function TO_DATE(SYSDATE, 'YYYY-MM-DD')
the getTimestamp
sometimes returns a negative value, sometimes it returns the correct value.
I know that TO_DATE
is not being used correctly because it should receive a string. But even so, I'd like to know why the result varies.
Note: this variation only occurs in getTimestamp
of Java. If I run TO_DATE
directly in the database, the result is always the same.
Obs2: When the result comes negative, the formatted date returned by the function is 0014-03-17 00:00:00.0
and when it comes the correct result comes as 2017-03-14 00:00:00.0
.