i have an table its having four fields cost,retail,units,weekdayyr. sample data is given below.
prv_wk_item_cost = previous week(tot_cost + tot_retail + tot_units).
Appreciable your help
I can't match your sample data and required output based on your narrative.
But it seems you don't need recursion, a simple OLAP function might be enough:
SUM(tot_cost + tot_retail + tot_units)
OVER (ORDER BY weekdayofyr
ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING),
SUM(cost) AS tot_cost,
SUM(retail) AS tot_retail,
SUM(units) AS tot_units,
GROUP BY weekdayofyr
ORDER BY weekdayofyr