SteveBurch
Programmer
Hi,<br><br> I'm a pl/sql newbie hitting a problem with a declared variable. Hopefully I'm doing something stupid and someone will be able to point it out. The variable in question from the code below is "total_mrp" - basically, as soon as I refer to it within the code(adding it to another field) it seems to 'disappear' - I've put displays in and until this line it shows up ok (as zero), but after the display brings nothing back, but the code loops the whole way through the cursor, so it's obviously going through the line but nothing is happening and it's not falling over either.<br> If anyone has any ideas, or if I canm give any further info, please let me know.<br> Thanks in advance,<br><br> Steve Burch<br><br><br>begin<br> declare cursor c_shortfall is<br> select part_nbr, mrp_qty, (1 - (mrp_qty / demand_qty )) * 100<br>Shortfall<br> from shortfall<br> where demand_qty != 0<br> order by Shortfall desc<br> for update;<br> shortfall_rec c_shortfall%rowtype;<br> total_mrp NUMBER (13,4) := 0;<br>begin<br> open c_shortfall;<br> loop<br> fetch c_shortfall into shortfall_rec;<br> exit when c_shortfall%notfound;<br> total_mrp:= total_mrp + shortfall_rec.mrp_qty;<br> update shortfall set mrp_tot_qty = total_mrp<br> where current of c_shortfall;<br> end loop;<br> close c_shortfall;<br>end;<br>end;