0

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

Vaishali
  • 117
  • 1
  • 2
  • 9
  • 1
    You need to passing parameter `cur_OUT` while executing stored proc. https://social.msdn.microsoft.com/Forums/en-US/ee5b723c-a2e5-47ce-b96d-c896975c1e34/how-to-call-oracle-function-using-c?forum=adodotnetdataproviders – Chetan Apr 23 '18 at 10:34
  • I tried using cur_out with EnterpriseLibrary 6 of Microsoft, I got the same error. Link provided by you shows how to use stored procedures using System.Data.OracleClient but I need for EnterpriseLibrary 6 – Vaishali Apr 24 '18 at 05:27

1 Answers1

0

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"
Vaishali
  • 117
  • 1
  • 2
  • 9