how to write a 10G model clause for this
Hi ,
I am using Oracle 10G and i am trying to use the MODEL clause to cater for the following logics
data :
Row MCH_ID Date Failure_reason Working_hour(hrs) Working%
1 1 6/1/2009 8 0
2 1 6/2/2009 8 8
3 1 6/3/2009 8 16
4 1 6/4/2009 8 24
5 1 6/5/2009 Hydraulic 0 32
6 1 6/6/2009 Hydraulic 0 0
7 1 6/7/2009 8 0
8 1 6/8/2009 8 8
9 1 6/9/2009 8 16
Logics :
1 - 1st row will be 0 for working% & failure%
2 - if machine is working the next day , working% will add 8 hours
3 - if machine is down then the next day, the working% will be reset to 0%
pls advise
tks & rgds
Edited by: user517698 on Jun 14, 2009 7:02 PM