You are on page 1of 1

DECLARE

cursor cur_empstars is
select new_emps.employee_id, new_emps.salary
from new_emps;
v_empno new_emps.employee_id%TYPE;
v_asterisk new_emps.stars%TYPE;
v_thousands new_emps.salary%TYPE;
BEGIN
open cur_empstars;
loop
fetch cur_empstars into v_empno, v_thousands;
exit when cur_empstars%NOTFOUND;
FOR i in 1..v_thousands
LOOP
v_asterisk := v_asterisk || '*';
END LOOP;
UPDATE new_emps
SET stars = v_asterisk
WHERE employee_id = v_empno;
v_asterisk := NULL;
end loop;
close cur_empstars;
END;

You might also like