call spMante_DevengeCopiar(1, 2, 1);

DROP PROCEDURE IF EXISTS spMante_DevengeCopiar;
CREATE PROCEDURE spMante_DevengeCopiar(
	varOrigen   int,
  varDestino  int,
  varUsuario  int
)
BEGIN
  delete from _srh_devenge_regimen
  where id_periodo_afp = varDestino;
  
  insert into _srh_devenge_regimen
  select id_regimen, varDestino, porc_comision, porc_prima, porc_fondo,
  NOW(), NOW(), varUsuario, varUsuario, 'A'
  from _srh_devenge_regimen
  where id_periodo_afp = varOrigen;
  select 'OK';
END;
