Please, help me to convert this loop statement:
BEGIN
FOR employee_rec in (SELECT * FROM BONUS)
LOOP
IF employee_rec.BONVALUE > 500 THEN
UPDATE BONUS
SET BONUS.TAX = BONUS.BONVALUE * 0.12 WHERE employee_rec.BONVALUE = BONUS.BONVALUE;
ELSIF
-- ...
END IF;
END LOOP;
END;
into statement where CURSOR being used.
cursor. Hope example of conversion will clarify for me both aspects.SELECT * FROM BONUSis. If you want to name that cursor, well, it's not that difficult... simply define a cursor in the declaration section and give it a name. However, it looks like in this instance, you don't need a cursor-for-loop at all; I'm guessing that the other IF clauses are also updates to the bonus table? If so, you ought to be able to achieve this in a single update statement