Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

day to second interval: How to trunc to hours-minutes

juliojgsAug 28 2015 — edited Aug 28 2015

oracle 11g

I want to store in db an hour to minute interval.

As this type is not supported, the nearest I've found is day(0) to second(0)

The source data will be a number(4,2), but I want to get rid of the seconds part, rounding to the nearest minute.

For example, this query;

SELECT Numtodsinterval (2.76 , 'hour') FROM DUAL;

returns +00 02:45:36.000000

I want to round it to

+00 02:46:00.000000

just the same way you can round a date to minute precision with round:

select round (sysdate, 'MI') from dual;

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 25 2015
Added on Aug 28 2015
3 comments
2,430 views