Discussions
Categories
- 17.9K All Categories
- 3.4K Industry Applications
- 3.3K Intelligent Advisor
- 62 Insurance
- 536.1K On-Premises Infrastructure
- 138.2K Analytics Software
- 38.6K Application Development Software
- 5.7K Cloud Platform
- 109.4K Database Software
- 17.5K Enterprise Manager
- 8.8K Hardware
- 71.1K Infrastructure Software
- 105.2K Integration
- 41.6K Security Software
"CEIL"-function for dates

A minor nuisance is to determine the closing border of an arbitrary interval covering a date-time-value.
It would be nice to have CEIL(SYSDATE, 'MM'), CEIL(SYSDATE, 'YYYY'), etc. analogous to TRUNC(SYSDATE, 'MM'), TRUNC(SYSDATE, 'YYYY'), etc. It´s possible for instance, to use the calendaring syntax for this purpose, but it would be neater for configuration-entries, for selection of date-intervals, etc. to be able to use an equivalent of TRUNC.
(This is the renewal of the enhancement request 6331253.992, accepted — "Please monitor it from time to time keeping in mind that it may take some long time to be applied." — from Oracle on 31-May-2007.)
Comments
-
This would work well with my proposed idea:
<strong> where</strong> event_date <strong>between</strong> start_date <strong>and ceil(</strong>start_date<strong>,'</strong>DD<strong>') <span style="color: red;">exclusive</span></strong>
That depends upon what exactly the proposed CEIL() function actually returns. Personally I'd find it more useful if it returned the last second of the time period concerned, rather than the first second that falls outside it.
i.e. CEIL(sysdate,'yyyy') should return 23:59:59 on 31 December this year, rather than 00:00:00 on 1st January next year.
-
That depends upon what exactly the proposed CEIL() function actually returns. Personally I'd find it more useful if it returned the last second of the time period concerned, rather than the first second that falls outside it.
i.e. CEIL(sysdate,'yyyy') should return 23:59:59 on 31 December this year, rather than 00:00:00 on 1st January next year.
Chris, I totally agree. I'm always doing a between from_date and trunc(end_date)+86399/86400 just to get the last second included in a date range.