CREATE PROCEDURE dbprincipal.spaltamodfjlaboratorios(
 IN imanufacturer varchar(100)

 )
    NO SQL
begin

declare ExisteLaboratorio  int;

set ExisteLaboratorio = (select ExisteLaboratorio from fjlaboratorios where manufacturer = ucase(imanufacturer) );

if (ExisteLaboratorio > 0) then

	set ExisteLaboratorio = -500;

else

	INSERT INTO ExisteLaboratorio 

			(manufacturer)

	values

			(ucase(imanufacturer));

	set ExisteLaboratorio=(select last_insert_id());

end if; 

select ExisteLaboratorio;



END