title: Delphi Stored Procedure Output
body: <p>Can anyone help me capture an output variable from a stored procedure in a delphi variable please?
  I've look at other questions here and had little success implementing</p>
  
  <p>At the moment I have a stored procedure:</p>
  
  <pre class="lang-sql prettyprint-override"><code>DELIMITER $$
  
  CREATE DEFINER=`root`@`localhost` PROCEDURE `return_10`(out x varchar(5))
  BEGIN
    SET x = 10;
  
  END
  </code></pre>
  
  <p>As you can see it is a very basic procedure.</p>
  
  <p>In delphi I want to call this procedure and capture the output variable and have tried the following but I have a feeling its wrong. </p>
  
  <p>Implementation:</p>
  
  <pre class="lang-pascal prettyprint-override"><code>var
    stored_proc: TADOStoredProc;
  
  (* GETTING A RETURN VALUE FROM A STORED PROCEDURE *)
  
  stored_proc.ProcedureName := 'return_10';
  stored_proc.Parameters.Clear;
  stored_proc.Parameters.CreateParameter( '@RETURN_VALUE', ftInteger, pdReturnValue, 10, null);
  stored_proc.ExecProc;
  lbl_connected.Caption := stored_proc.Parameters.ParamByName( '@RETURN_VALUE' ).Value
  </code></pre>