not able to use trunc() in a timestamp column #34903
-
when I use oracle sql developer with the same query the funciton is working, hower in DBeaver it is not working. Any ideas, I have tried display formats and Data Formats but no luck. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Good news, the trunc() function works as the time part is 00:00:00.. it's only visual. Try the same with sysdate. Dbeaver formats values based on type, and even if you truncate datetime it is still datetime in both DB application. |
Beta Was this translation helpful? Give feedback.
-
One last question, how do I open the window to edit the JDBC driver? |
Beta Was this translation helpful? Give feedback.
I was wrong. The formatting is based on JDBC type.
The jdbc driver will map date as timestamp because the oracle date type has time values in it while JDBC date doesn't. So you will lose the time part of the date while transforming it. You can force to hide it, but be careful with it.
You can change it here:
Enabling this setting will result in the following:
select creation_date, trunc(creation_date) truncated, to_date(trunc(CREATION_DATE), 'DD-MM-YY') to_date_and_truncated, cast(CREATION_DATE AS DATE) casted, sysdate, cast(SYSDATE AS TIMESTAMP) from table
You can see that the sysdate value returns an oracle date type, therefore you will not see the time value on it unless you change i…