Oracle stored procedure throwing parameter mismatch error

541 Views Asked by At

I am trying to call Oracle stored procedure using Microsoft.Practices.EnterpriseLibrary 6 in C#

Below is my stored procedure

create or replace 
PROCEDURE         "US_GET" (inputa IN integer,
  cur_OUT IN OUT SYS_REFCURSOR)
IS
 cur_N SYS_REFCURSOR;
 BEGIN
 OPEN cur_N FOR
SELECT columnb FROM tablea 
WHERE columna = inputa;
 cur_OUT := cur_N;
end US_GET;

Code below is used for calling this procedure

DatabaseProviderFactory factory = new DatabaseProviderFactory();
Database db = factory.Create(DataBaseInstance);
DbCommand dbCommand = db.GetStoredProcCommand("US_GET");
db.AddInParameter(dbCommand, "inputa", DbType.Int32, 0);
Dataset ds = db.ExecuteDataSet(dbCommand); 

I am getting below error on runtime

Oracle.DataAccess.Client.OracleException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'US_GET'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

Has anyone came across this error ?? Is there any fix available for it?? I tried different ways of implementing this, but couldn't arrive at the solution

1

There are 1 best solutions below

0
Vaishali On

I changed the provider in connection string from the below format

connectionString="Provider=OraOLEDB.Oracle;Data Source=;User ID=;Password=;OLEDB.NET=true;PLSQLRSet=true;"

to this format and it worked

connectionString="Data Source=;User ID=;Password=;" providerName="System.Data.OracleClient"