I have a DATE
column that I want to round to the next-lower 10 minute interval in a query (see example below).
I managed to do it by truncating the seconds
Another method,
select my_date - mod( (my_date-trunc(my_date))*24*60, 10)/24/60
from (
select sysdate my_date from dual
);
An alternative that might be quicker as it removes the call to trunc.
select my_date - mod( (my_date-to_date('1970', 'yyyy'))*24*60, 10)/24/60
from (
select sysdate my_date from dual
);