DELIMITER $$
CREATE PROCEDURE 'capturar_consecutivo'(numero int) RETURNS int
BEGIN
DECLARE num int DEFAULT 0;
SET num = ( SELECT * FROM consecutivo where consecutivo.numero=numero );
RETURN num
END
$$
DELIMITER ;
I'm trying to create this stored procedure with return values, but when I create it the system throws me an error:
"# 1064 - Something is wrong in its syntax near 'int BEGIN"
But I do not understand what the error is, according to me the syntax is correct, someone to guide me in the correct syntax?