4
I have the following problem:
I use the JDBC to connect with Oracle. And I call rs.getTimestamp(index) to pick up a date field.
When I run the function TO_DATE(SYSDATE, 'YYYY-MM-DD') the getTimestamp sometimes returns a negative value, sometimes returns the correct value.
I know that the TO_DATE is not being used correctly as it should receive a string. But even so, I would like to know why the result varies.
Obs: this variation only occurs in getTimestamp java. If I run the TO_DATE directly in the bank, the result is always the same.
Note²: When the result is negative, the formatted date returned by the function is 0014-03-17 00:00:00.0 and when the right result comes as 2017-03-14 00:00:00.0.
Maybe this will help http://www.guj.com.br/t/formatar-data-no-padrao-dd-mm-yyyyyy-hh-mm-ss/42479
– R.Santos
TRUNC(SYSDATE)? Thus, the time is taken.– Marcelo Shiniti Uchimura