title: how to call an oracle function in package on c#
body: <p>Here is my pl sql code (a package including a function):    </p>
  
  <pre><code>CREATE OR REPLACE 
  PACKAGE PACKAGE_REQUETE
  IS
  FUNCTION REQUETEFONCTION (ParametreId       requete.id%TYPE ) RETURN number;
  END PACKAGE_REQUETE;
  /
  CREATE PACKAGE BODY  PACKAGE_REQUETE
  IS
  FUNCTION REQUETEFONCTION (ParametreId          requete.id%TYPE )
  RETURN number IS
  VariableId requete.id%TYPE ;
  BEGIN
  SELECT   id INTO   VariableId FROM   requete WHERE   id = ParametreId;
  RETURN VariableId;
  EXCEPTION WHEN OTHERS
  THEN
      RETURN (-1);
  END REQUETEFONCTION;
  END PACKAGE_REQUETE;
  /
  </code></pre>
  
  <p>I tried calling it from windows form application using <code>ExecuteScalar</code> and <code>ExecuteNonQuery</code> without luck.</p>
  
  <p>Please find <code>C#</code> code below:</p>
  
  <pre><code>private void button3_Click_1(object sender, EventArgs e)
      {
          OracleConnection conn = new OracleConnection(Authentification.chaineConnection);    
          OracleCommand cmd = new OracleCommand("PACKAGE_REQUETE.REQUETEFONCTION(1)", conn);
          cmd.Connection = conn;
  
          conn.Open();
          cmd.CommandType = CommandType.StoredProcedure;
          textBox1.Text = cmd.ExecuteScalar().ToString();
      }
  </code></pre>
  
  <p>Could you please help me find what is causing the error.</p>