Skip to content

Instantly share code, notes, and snippets.

@GreyHat147
Created April 22, 2018 01:54
Show Gist options
  • Save GreyHat147/d0d8eef51aff9cf1eedc92e43017daaa to your computer and use it in GitHub Desktop.
Save GreyHat147/d0d8eef51aff9cf1eedc92e43017daaa to your computer and use it in GitHub Desktop.
16, 17
/* 16. */
create table empleados_antiguos (
documento varchar(8),
nombre varchar(40)
);
/* 17. */
/*DROP PROCEDURE IF EXISTS empleados_antiguos;*/
delimiter $
create procedure empleados_antiguos(in _documento int(11))
begin
set @fecha = (select fechaingreso from parcial.empleados where documento = _documento);
set @nombre = (select nombre from parcial.empleados where documento = _documento);
set @apellido = (select apellido from parcial.empleados where documento = _documento);
IF NOT @fecha between '2008-01-01' AND '2018-01-01' then
set @fullname = CONCAT(@nombre, ' ', @apellido);
insert into empleados_antiguos values (_documento, @fullname);
END IF;
end;
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment