title: Calling a PROCEDURE with output parameters
body: <p>I've got an ORACLE package which receives few parameters and returns - with some other (output) parameters - a unique value (number).<br>
  Here's is the package code:</p>
  
  <pre><code>create or replace
  PACKAGE BODY           "USP_SHIPMENTS" AS
  
      PROCEDURE  usp_GetNewShipmentNumber
      (
      pErrorCode OUT NUMBER,
      pMessage OUT VARCHAR2,      
      pCompanyCode IN CHAR,
      pNumber OUT VARCHAR2
      )
  
      IS
  
        BEGIN
  
      pErrorCode := 0;
  
         UPDATE 
          UTSASHN
         SET 
          UTSASHN.UTSHNCOR = UTSASHN.UTSHNCOR + 1
         WHERE 
          UTSASHN.UTSHCOSC = pCompanyCode AND UTSASHN.UTSHTIPO = 'S***'
      RETURNING 
          CONCAT(TRIM(UTSASHN.UTSHDESC) , TRIM(to_char(UTSASHN.UTSHNCOR, '000000'))) INTO pNumber;
  
      EXCEPTION
          WHEN OTHERS THEN 
                pErrorCode := SQLCODE;
                ROLLBACK;
  
      END usp_GetNewShipmentNumber;
  
  END USP_SHIPMENTS;
  </code></pre>
  
  <p>I've been using this package for a long time using ODP.NET and everything has always worked properly.<br>
  Now I am developing a new App with nHibernate 3.1.0.4000. 
  So far I've been able to map all my entities and execute regular queries. Everything works fine.<br>
  I was trying to call this package but I keep on getting errors.</p>
  
  <p>This is the mapping for the PROCEDURE:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="BpSpedizioni" namespace="BpSpedizioni.Domain"&gt;
      &lt;sql-query name="GetNewShipmentNumber"&gt;
          { call USP_SHIPMENTS.usp_GetNewShipmentNumber ( :pErrorCode, :pMessage, :pCompanyCode, :pNumber) }
      &lt;/sql-query&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p>and this is the call:</p>
  
  <pre><code>Session.GetNamedQuery("GetNewShipmentNumber")
        .SetParameter("pErrorCode", "")
        .SetParameter("pMessage", "")
        .SetParameter&lt;string&gt;("pCompanyCode", "HBP00")
        .SetParameter("pNumber", 0)
        .UniqueResult();
  </code></pre>
  
  <p>I've tried with <code>.UniqueResult()</code> or <code>.ExecuteUpdate()</code> or <code>.List()</code> but I can only get exceptions:</p>
  
  <pre><code>could not execute query
  [ USP_SHIPMENTS.usp_GetNewShipmentNumber ]
    Name:pErrorCode - Value:  Name:pMessage - Value:  Name:pCompanyCode - Value:HBP00  Name:pNumber - Value:0
  [SQL: USP_SHIPMENTS.usp_GetNewShipmentNumber]
  </code></pre>
  
  <p>and this is the InnerException:</p>
  
  <pre><code>ORA-06550: line 1, column 7:
  PLS-00306: wrong number or types of arguments in call to 'USP_GETNEWSHIPMENTNUMBER'
  ORA-06550: line 1, column 7:
  PL/SQL: Statement ignored
  </code></pre>
  
  <p>I can't figure out what I am doing wrong!
  Is there anybody who can help me?</p>