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
I generally hate doing date -> character -> date conversions when it's not necessary. I'd rather use numbers.
select trunc((sysdate - trunc(sysdate))*60*24,-1)/(60*24)+trunc(sysdate) from dual;
This extracts the minutes from the current day, truncates them down to the 10-minute interval, and then adds them back in to make it a date again. Of course, you can replace sysdate with whatever date you want. It trusts implicit conversions a lot more than I want but at least it'll work for any NLS date format.