I have an Oracle stored procedure that does only an update. It is a legacy stored proc and I must use it. It cannot be changed.
I can call and execute it from C# with Nhibernate fine as follows:
var query = Session.CreateSQLQuery("call myPackage.mySproc(:param1, :param2, :param3)");
query.SetInt64("param1", 123456);
query.SetInt64("param2", 654321);
query.ExecuteUpdate();
I would prefer to use a named query if possible. I've tried the following:
Session
.GetNamedQuery("myNamedQuery")
.SetInt64("param1", 123456)
.SetInt64("param2", 654321)
.ExecuteUpdate();
where my named query looks like this:
<sql-query name="myNamedQuery">
{ call myPackage.mySproc(:param1, :parm2) }
</sql-query>
When I try this, I get the error:
could not execute native bulk manipulation query
with inner exception:
ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'mySproc' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
Now I have of course double checked my parameter list, it matches in the code, the mapping xml and the sproc itself.
Am I way off? Should this be possible? Do I need a in the mapping even though there is no return data? it only executes a SQL update.