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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

wrong result of 11gR2 Recursive with clause part3

Aketi JyuuzouApr 17 2010 — edited Jul 12 2010
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

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 5 2010
Added on Apr 17 2010
4 comments
2,637 views