First attempt at a stored procedure. cant quite figure it out.
this is my first attempt at using store procedures in TD. ive gotten it down to a single error message, but i cannot seem to resolve this final one. would appreciate any help. i am 99% sure it is related to my set statement.
CREATE PROCEDURE blackbird.Sp2() BEGIN FOR vFor AS cName CURSOR FOR SELECT day_time as t, mth_idnt as m, day_idnt as d FROM blackbird.real_data_prep DO UPDATE blackbird.real_data_prep SET price_rank = ( SELECT RANK(price) as Rk FROM ( SELECT day_time, price FROM blackbird.real_data_prep WHERE mth_idnt = vFor.mth_idnt AND day_idnt = vFor.day_idnt AND day_time <= vFor.day_time QUALIFY Rank(day_time) <= 100 ) AS a QUALIFY day_time = vFor.day_time ) WHERE CURRENT OF cName; END FOR; END;