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!

ORA-32637: Self cyclic rule in sequential order MODEL

62742Sep 19 2008 — edited Sep 23 2008
Hi Folks,

I get
ERROR at line 8:
ORA-32637: Self cyclic rule in sequential order MODEL

SELECT *
FROM (
SELECT emp_id
, time_sheet_date
, wrkd_hrs
, worked_hrs_total
, max_cons_days max_cons_days
FROM te.time_sheet_daily t
where ddso_cd ='0200'
--and emp_id ='E000015'
and nvl(wrkd_hrs,'0') > 0
and trunc(time_sheet_date) >= to_date('01-01-2006','DD-MM-YYYY')
and trunc(time_sheet_date) <= trunc(sysdate)
and time_sheet_seq = (select max(t1.time_sheet_seq)
from te.time_sheet_daily t1
where t1.time_sheet_daily_id = t.time_sheet_daily_id
)
MODEL
PARTITION BY (emp_id)
DIMENSION BY (
ROW_NUMBER() OVER (ORDER BY t.emp_id,t.time_sheet_date) rn
)
MEASURES(
time_sheet_date
, wrkd_hrs
, 0 worked_hrs_total
, 0 cons_group
, 0 max_cons_days
)
RULES
(
cons_group[rn] = CASE WHEN time_sheet_date[CV(rn)] - time_sheet_date[CV(rn)-1] = 1
THEN cons_group[CV(rn)-1]
ELSE NVL(cons_group[CV(rn)-1], 0) + 1
END
,max_cons_days[rn] = COUNT(*) OVER (PARTITION BY cons_group)
,worked_hrs_total[rn] = SUM(wrkd_hrs) OVER (PARTITION BY cons_group)
)
)
WHERE max_cons_days >= 2
ORDER BY emp_id,time_sheet_date;

But if I run it for a single emp_id or couple of them it runs fine. I could not find any explanation of this error.
Can someone help ???


Thanks a lot.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 21 2008
Added on Sep 19 2008
6 comments
261 views