Sudipta Saha

Sudipta Saha

  • NA
  • 85
  • 13.6k

ORA-06550 store procedure error PLS-00306: wrong number

Jan 4 2018 7:50 AM
I have a store procedure like this :
 
PROCEDURE PRC_ABCD_GETALL (resultset_out OUT TYPES.cursorType)
AS
BEGIN
OPEN
resultset_out FOR SELECT * FROM ABCD;
END PRC_ABCD_GETALL;
 
and this procedure is in package and the package is like this

create or replace
PACKAGE V4_EVT_PKG_ABCD_GENERAL
AS

PROCEDURE PRC_ABCD_GETALL (resultset_out OUT TYPES.cursorType);

END V4_EVT_PKG_ABCD_GENERAL;

and the oracle data provider was system.data.oracleClient and I used this code
public static IEnumerable<PortalList> GetAll()
{
Database db = DatabaseFactory.CreateDatabase();
DbCommand objComm = db.GetStoredProcCommand("package_name.sp", new object[1]);
var result = new List<PortalList>();
using (IDataReader rdr = db.ExecuteReader(objComm)){
while (rdr.Read()){
result.Add(Construct(rdr));
}
}
return result;
}
and now i found out that system.data.oracleClient is depricated and i want to use Oracle.DataAccess.Client as data provider
I wrote C# code for this but I am facing some errors like wrong number or types of arguments in call to 'PRC_ABCD_GETALL'
in this function PortalListRepository.GetAll();

private static IEnumerable<PortalList> GetAll(bool forceDataReload)
{
const string cacheKey = "PortalListService_GetAll";

IEnumerable<PortalList> result = null;

if (!forceDataReload)
result = GetFromCache(cacheKey);

if (result == null)
{
result = PortalListRepository.GetAll();
AddToCache(cacheKey, result);
}

return result;
}

that I can't solve.

C# code

public static IEnumerable<PortalList> GetAll()
{
string cnn = "connectionstring";
var result = new List<PortalList>();
using (OracleConnection conn = new OracleConnection(cnn))
{
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "PRC_ABCD_GETALL";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("resultset_out", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
OracleDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
result.Add(Construct(rdr));
}
}
return result;
}

I am very much new to this I don't know how to solve it.Anybody have any idea what am i doing wrong??pls help 

Answers (2)