title: How to use mybatis to return a value from procedure call?
body: <p>We call many stored procs using myBatis which have IN / OUT parameters which we know how to handle</p>
  
  <p>But I dont know how to handle when the procedure actually returns a value instead of declaring it as a OUT param</p>
  
  <p>For example using a SQL editor (TOAD for SQL Server) I can run a proc and get a return value as so:</p>
  
  <pre><code>DECLARE @return_value int;
  
  EXEC  @return_value = someProcedure 
      @param1 = 'abc',
      @param2 = 12345
  
  SELECT @return_value as N'@Return Value';
  
  GO
  </code></pre>
  
  <p>However I have only ever gotten results as either result sets and dont know how to handle this scenario. I thought something like this might work:</p>
  
  <pre><code>&lt;select id="callSomeProcedure" resultType="java.lang.Integer" statementType="CALLABLE"&gt;
      { call someProcedure  (
              #{param1},
              #{param2}
      ) }
  &lt;/select&gt;
  </code></pre>
  
  <p>But it returns NULL</p>
  
  <p>Any ideas?</p>