title: MySQL stored procedure return value
body: <p>I have to create an SP that returns a value if it's valid or not. But it doesn't return anything and I don't know, why?</p>
  
  <pre><code>CREATE DEFINER=`root`@`localhost` PROCEDURE `validar_egreso`(
      IN codigo_producto VARCHAR(100),
      IN cantidad INT,
      OUT valido INT(11)
  )
  BEGIN
      DECLARE resta INT(11);
      SET resta = 0;
  
      SELECT (s.stock - cantidad) INTO resta
      FROM stock AS s
      WHERE codigo_producto = s.codigo;
  
      IF (resta &gt; s.stock_minimo) THEN
          SET valido = 1;
      ELSE
          SET valido = -1;
      END IF;
      SELECT valido;
  END
  </code></pre>