简体   繁体   English

Oracle存储过程抛出参数不匹配错误

[英]Oracle stored procedure throwing parameter mismatch error

I am trying to call Oracle stored procedure using Microsoft.Practices.EnterpriseLibrary 6 in C# 我正在尝试使用C#中的Microsoft.Practices.EnterpriseLibrary 6调用Oracle存储过程

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 我尝试了不同的方法来实现此目的,但无法找到解决方案

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"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM