TRUNCATE does not work for all databases
Posted: Thu 17 Nov 2016 16:19
I have 2 macros:
{Currentdate}="SYSDATE" in oracle, "localtimestamp" in postgres.
{fromdual}="From dual" in oracle, "" in postgres.
=> query
select {fn TRUNCATE({currentdate},'DDD') } {fromdual}
=> Works fine in oracle, not in postgres. In postgres, using db monitor, I see that truncate is mapped to trunc function that (according to postgres documentation) can not be used on datetime (date_trunc should be used in postgres).
I need a way to truncate any timestamp to the date at 0h00, that would work with (at least) oracle and postgres. Any hint?
Thank you
{Currentdate}="SYSDATE" in oracle, "localtimestamp" in postgres.
{fromdual}="From dual" in oracle, "" in postgres.
=> query
select {fn TRUNCATE({currentdate},'DDD') } {fromdual}
=> Works fine in oracle, not in postgres. In postgres, using db monitor, I see that truncate is mapped to trunc function that (according to postgres documentation) can not be used on datetime (date_trunc should be used in postgres).
I need a way to truncate any timestamp to the date at 0h00, that would work with (at least) oracle and postgres. Any hint?
Thank you