This thread is continued from
1056886
and
1057057
and
1061529
select * from v$version;
BANNER
-------------------------------------------------------
Oracle Database 11g Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
col Val for a30
create table sumInter(Val) as
select interVal '40' minute from dual union all
select interVal '15' minute from dual;
with work(Rn,Val,recCnt) as(
select RowNum,Val,Count(*) over() from sumInter),
rec(Rn,Val,recCnt) as(
select Rn,Val,recCnt
from work
where Rn = 1
union all
select b.Rn,a.Val+b.Val,a.recCnt
from rec a,work b
where a.Rn+1 = b.Rn)
select * from rec;
RN VAL RECCNT
-- ------------------------------ ------
1 +000000000 00:40:00.000000000 2
2 +000000000 00:25:00.000000000 2
But correct result is below X-(
RN VAL RECCNT
-- ------------------------------ ------
1 +000000000 00:40:00.000000000 2
2 +000000000 00:55:00.000000000 2