Answer the question
In order to leave comments, you need to log in
The procedure is not created, what causes the error?
I am learning MySQL. I cannot create procedure and I do not understand why. Tell me please.
create procedure SumarNumerosParesConsecutivosHastaMaximo (IN maximo int)
BEGIN
declare i int;
declare suma int;
set i = 2;
set suma = 0;
IF (maximo < 0) THEN
select concat('ERROR') Mensaje;
ELSE
while (i <= maximo) do
if (mod(maximo,2) = 0) then
set suma = suma + i;
set i = i + 2;
select concat('El resultado de suma es ', suma) Resultado;
esleif (mod(maximo,2) <> 0) then
set suma = suma + i;
set i = i + 2;
select concat('El resultado de suma es ', suma) Resultado;
end if;
end while;
end if;
end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question