title: Select a variable to output from within stored procedure in Teradata
body: <p>I have a stored procedure I've started coding and need to return a value.  In SQL Server I could just do a SELECT of the variable to return it.  However this does not seem to work with Teradata and have not found a similar example on how to do this.  Here is my stored procedure:</p>
  
  <pre><code>REPLACE PROCEDURE sp_Get_MyValue()
  BEGIN
  DECLARE mytestvar  VARCHAR(40);
  SELECT mycolumn INTO mytestvar FROM MyTable;
  SELECT mytestvar;
  END;
  </code></pre>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>STATEMENT 2: REPLACE  failed.  Failed [5526 : HY000] Stored Procedure
    is not created/replaced due to error(s).{Nested Failure Msg [5526 :
    HY000] SPL1045:E(L10), Invalid or missing INTO clause.}</p>
  </blockquote>
  
  <p>I also tried adding an OUT variable to the procedure but that did not work either:</p>
  
  <pre><code>REPLACE PROCEDURE sp_Get_MyValue(mytestvarout VARCHAR(40))
  BEGIN
  DECLARE mytestvar  VARCHAR(40);
  SELECT mycolumn INTO mytestvar FROM MyTable;
  END;
  </code></pre>
  
  <p>With this error:</p>
  
  <blockquote>
    <p>Executed as Single statement.  Failed [5531 : HY000] Named-list is not
    supported for arguments of a procedure.  Elapsed time = 00:00:00.079</p>
  </blockquote>