
Ayuda con cursores explícitos pl/sql
Publicado por omar (1 intervención) el 16/11/2014 02:44:43
Hola, necesito ayuda con un cursor que tiene errores, pero no se cuales son. Si me podrían decir cuales son se los agradecería. Enseguida dejo el código del cursor:
declare
cursor c1 select snum, city from personnel p, branch b where p.div = b.div;
v_city b.city%type;
v_snum personnel.snum%type;
v_salary_1 number=30000;
v_salary_2 number(4):= 25000;
v_salary_3 number:=20000;
v_salary personnel.salary%type;
begin
open c1;
loop
fetch c1 into v_snum, v_city;
exit where c1%NOTFOUND;
if v_city='LONDON' then v_salary:= v_salary1;
elsif v_city='BRISTOL' then v_salary:=v_salary_2;
else v_sal:= v_salary_3;
end if;
update my_personnel set salary = v_salary where snum=v_snum;
endloop;
close;
end;
Espero puedan ayudarme, de antemano muchas gracias =)
declare
cursor c1 select snum, city from personnel p, branch b where p.div = b.div;
v_city b.city%type;
v_snum personnel.snum%type;
v_salary_1 number=30000;
v_salary_2 number(4):= 25000;
v_salary_3 number:=20000;
v_salary personnel.salary%type;
begin
open c1;
loop
fetch c1 into v_snum, v_city;
exit where c1%NOTFOUND;
if v_city='LONDON' then v_salary:= v_salary1;
elsif v_city='BRISTOL' then v_salary:=v_salary_2;
else v_sal:= v_salary_3;
end if;
update my_personnel set salary = v_salary where snum=v_snum;
endloop;
close;
end;
Espero puedan ayudarme, de antemano muchas gracias =)
Valora esta pregunta


0