Oracle generating time INTERVAL without crossing next day
Solution 1:
Instead of trying to specify N with an exact number of intervals, you can use a start date/end date logic to generate the intervals.
SELECT DATE '2022-01-11' + NUMTODSINTERVAL (LEVEL * 10, 'MINUTE')
FROM DUAL
CONNECT BY DATE '2022-01-11' + NUMTODSINTERVAL (LEVEL * 10, 'MINUTE') < DATE '2022-01-12';
Solution 2:
This is a nice use case for a recursive CTE.
with dt (dt, interv) as (
select date '2022-01-11', numtodsinterval(10,'MINUTE') from dual
union all
select dt.dt + interv, interv from dt
where dt.dt + interv < trunc(dt.dt)+1)
select dt from dt;
DT
-------------------
11.01.2022 00:00:00
11.01.2022 00:10:00
11.01.2022 00:20:00
.....
11.01.2022 23:50:00
Note that I added the interval as a column, so you need not the repeat it twice in the query.
The start date and interval are used only once in the query, so you may them easily configure.