I've got an ORACLE package which receives few parameters and returns - with some other (output) parameters - a unique value (number).
Here's is the package 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;
I've been using this package for a long time using ODP.NET and everything has always worked properly.
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.
I was trying to call this package but I keep on getting errors.
This is the mapping for the PROCEDURE:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="BpSpedizioni" namespace="BpSpedizioni.Domain">
<sql-query name="GetNewShipmentNumber">
{ call USP_SHIPMENTS.usp_GetNewShipmentNumber ( :pErrorCode, :pMessage, :pCompanyCode, :pNumber) }
</sql-query>
</hibernate-mapping>
and this is the call:
Session.GetNamedQuery("GetNewShipmentNumber")
.SetParameter("pErrorCode", "")
.SetParameter("pMessage", "")
.SetParameter<string>("pCompanyCode", "HBP00")
.SetParameter("pNumber", 0)
.UniqueResult();
I've tried with .UniqueResult() or .ExecuteUpdate() or .List() but I can only get exceptions:
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]
and this is the InnerException:
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
I can't figure out what I am doing wrong! Is there anybody who can help me?