lunes, 30 de abril de 2012

Clase 28 de Abril

declare
Cursor tipoIdCursor is
select EMPLOYEE_ID from employees;
vemployee_id employees.employee_id%type;
vtipoId employees.Tipoid%type;
begin
open tipoIdCursor;
loop
fetch tipoIdCursor into vemployee_id;
exit when tipoIdCursor%NOTFOUND;
if mod(vemployee_id,2)= 0 then
  vtipoId := 'Par' ;
else
  vtipoId := 'Impar';
end if;
update employees
set Tipoid = vtipoId
where EMPLOYEE_ID = vemployee_id;
end loop;
close tipoIdCursor;
end;

No hay comentarios:

Publicar un comentario