1
I have the following protocol:
DELIMITER $$
CREATE PROCEDURE sp_CalculaVolume (
    IN vReservatorioCodigo bigint,
    OUT Retorno decimal
)
BEGIN
    Declare Formato int;
    Declare TipoReservatorio bigint;
    Declare retorno decimal;
    Declare vAltura decimal;
    DECLARE vDiametro decimal;
    Declare vRaio decimal;
    Declare vAresta1 decimal;
    Declare vAresta2 decimal;
    SELECT      @Formato := IFNULL(t.Formato, 0),
                @vAltura := d.Altura,
                @vAresta1 := d.Aresta1,
                @vAresta2 := d.Aresta2,
                @vDiametro := d.Diametro
    From        TipoReservatorio t 
    INNER JOIN  Reservatorio r ON (t.Codigo = r.TipoReservatorioCodigo)
    INNER JOIN  DimensaoReservatorio d ON (t.DimensaoReservatorioCodigo = d.Codigo)
    WHERE       r.Codigo = vReservatorioCodigo;
    IF Formato = 1 THEN
        SET vRaio = vDiametro / 2;
        SET retorno = 3.14 * (vRaio * vRaio) * vAltura;
    ELSE
        SET retorno = vAresta1 * vAresta2 * Altura;
    END 
END$$
Delimiter ;
As can be seen, the return parameter is set to OUT and I would like to have this parameter returned when calling this parameter. But that is not the case. When I run:
CALL sp_RetornaValor(1, @val); 
SELECT @val
As can be seen, it is not returning the OUT parameter, but the SELECT result I have inside the Procedure.

Thank you, Matheus. .
– Eduardo