I didn't succeed in calling a Oracle stored proc with Entlib 2, January 2006 and CoreLab OraDirect for .NET 2, version 3.55.20.0.
My stored procedure (in a package) is :
Code: Select all
create or replace package "XXX".pck_yyy as
type T_CURSOR is ref cursor;
function GetPersonalData(in_cardId in card.cardid%type, out_personCursor out T_CURSOR) return boolean;
end;
create or replace package body "XXX".pck_yyy as
function GetPersonalData(in_cardId in card.cardid%type, out_personCursor out T_CURSOR) return boolean
as
...
begin
open out_personCursor
for
select p.personid,
p.firstname,
p.name,
lang.languagename,
cat.categoryname
from ...
where ...;
return true;
end;
Code: Select all
DbCommand dbCommand = database.GetStoredProcCommand("pck_yyy.GetPersonalData");
database.AddParameter(dbCommand, "return", DbType.Boolean, 0, ParameterDirection.Output, false, 0, 0, String.Empty, DataRowVersion.Current, Convert.DBNull);
database.AddParameter(dbCommand, "in_cardId", DbType.String, 128, ParameterDirection.Input, false, 0, 0, String.Empty, DataRowVersion.Current, cardId);
OracleParameter op = new OracleParameter("outp_personCursor", OracleDbType.Cursor, 0, ParameterDirection.Output, true, 0, 0, String.Empty, DataRowVersion.Current, Convert.DBNull);
dbCommand.Parameters.Add(op);
DataSet ds = database.ExecuteDataSet(dbCommand);
I tried lots of variants in my code and looked for lots of web page in search of a solution.CoreLab.Oracle.OracleException: ORA-06550: line 2, column 3:
PLS-00306: wrong number or types of arguments in call to 'GETPERSONALDATA'
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored
at CoreLab.Oracle.OracleCommand.a(CommandBehavior A_0, IDisposable A_1, Int32 A_2, Int32 A_3)
at CoreLab.Common.DbCommandBase.c(CommandBehavior A_0)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.DoLoadDataSet(DbCommand command, DataSet dataSet, String[] tableNames)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.LoadDataSet(DbCommand command, DataSet dataSet, String[] tableNames)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.LoadDataSet(DbCommand command, DataSet dataSet, String tableName)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteDataSet(DbCommand command)
at Polyright.TPM.DataAccess.DatabaseAccess.GetPersonalData(String cardId) in ...
I'm probably wrong somewhere as a work with EntLib since a pair of weeks only.
Thanks,
Adriano