title: C# Oracle execute stored procedure with output parameter
body: <p>Situation:
  <br />I'm trying to run a stored procedure that has an output parameter, which I need to catch.
  <br />I use C# 3.5 and the OracleClient with an OleDbConnection.</p>
  
  <p>Research:
  <br />I've been looking around for other ways, but as far as I can tell I'm doing it correct. <a href="http://support.microsoft.com/kb/310070" rel="nofollow">Microsoft support</a> and various other forums.</p>
  
  <p>Problem:
  <br />When I do the cmd.ExecuteNonQuery() it just gets stuck. No error or anything, it just stops there and holds the Thread.
  <br />When I try via OleDbDataReader or the Scalar it's nothing better.
  <br />If I change the CommandText (remove package name) it gives error that it can't find the stored procedure, so I know that is correct at least.</p>
  
  <p>Code:<br />
  Oracle:</p>
  
  <pre><code>PROCEDURE deleteThemakaart
  (an_seqthemakaart IN NUMBER, an_retval OUT NUMBER)
  ....
  </code></pre>
  
  <p>C#:</p>
  
  <pre><code>double InputValue = 777;
  try
  {
      OleDbConnection con = new OleDbConnection(...);
      con.Open();
  
      OleDbCommand cmd = new OleDbCommand()
      {
          CommandText = "thema.pckg_themakaarten.deleteThemakaart",
          Connection = con,
          CommandType = CommandType.StoredProcedure,
      };
  
      OleDbParameter input = cmd.Parameters.Add("an_seqthemakaart", OleDbType.Double);
      OleDbParameter output = cmd.Parameters.Add("an_retval", OleDbType.Double);
  
      input.Direction = ParameterDirection.Input;
      output.Direction = ParameterDirection.Output;
  
      input.Value = InputValue;
  
      cmd.ExecuteNonQuery();
  
      return (double)output.Value;
  }
  catch (Exception ex)
  {
      ...
  }
  finally
  {
      con.Close();
  }
  </code></pre>
  
  <p>Any help is very welcome :)</p>
  
  <p>Edit: some code is below in comment, but hasn't gotten me any further so far :(</p>
  
  <p>Greetings</p>