Oracle SQL Model Current Value (CV)
SELECT country, prod, year, s1 yearly_qty, s model_sum  
FROM 
(SELECT 'IN' country, '2DR-Sedan' prod, 2010 year, 45450 qty 
 FROM DUAL  UNION
 SELECT 'IN' country, '4DR-Sedan' prod, 2010 year, 93720 qty
 FROM DUAL  UNION
 SELECT 'IN' country, 'Mini-van'  prod, 2010 year, 15770 qty
 FROM DUAL  UNION
 SELECT 'IN' country, '2DR-Sedan' prod, 2011 year, 55150 qty
 FROM DUAL  UNION
 SELECT 'IN' country, '4DR-Sedan' prod, 2011 year, 99770 qty
 FROM DUAL  UNION
 SELECT 'IN' country, 'Mini-van'  prod, 2011 year, 17350 qty
 FROM DUAL  UNION
 SELECT 'US' country, '2DR-Sedan' prod, 2010 year, 45450 qty
 FROM DUAL  UNION
 SELECT 'US' country, '4DR-Sedan' prod, 2010 year, 95770 qty
 FROM DUAL  UNION
 SELECT 'US' country, 'Mini-van'  prod, 2010 year, 15770 qty
 FROM DUAL  UNION
 SELECT 'US' country, '2DR-Sedan' prod, 2011 year, 55150 qty
 FROM DUAL  UNION
 SELECT 'US' country, '4DR-Sedan' prod, 2011 year, 99770 qty
 FROM DUAL  UNION
 SELECT 'US' country, 'Mini-van'  prod, 2011 year, 17350 qty
 FROM DUAL)
  MODEL
    PARTITION BY (country)
    DIMENSION BY (prod, year)
    MEASURES (qty s, qty s1)
    IGNORE NAV
    UNIQUE DIMENSION
    RULES UPSERT SEQUENTIAL ORDER
    (s[FOR prod IN ('2DR-Sedan', '4DR-Sedan'), 2011] = 
                     s[CV( ), 2010] + s[CV( ), 2011],
     s1[FOR prod IN ('2DR-Sedan', '4DR-Sedan'), 2010] =
                                            s1[CV( ), 2010])
ORDER BY country, prod, year;
SQL Model Current Value (CV)

SQL Model CV Complete Output

Oracle registered trademark of Oracle Corporation.

Last Revised On: 07/30/2014

  1446