在C#开发的web服务中调用存储过程的时候,报错:PLS-00306: 调用 '过程名' 时参数个数或类型错误。但参数个数与类型均正确,原因何在呢?
当然,问题可能就是参数个数或者类型不对。
这里还有另外一种可能,参看部分源码:
OracleParameter sqlParameter1 = new OracleParameter("pbillid",DbType.String);
sqlParameter1.Value = sShipbillID.ToString();
sqlCommand.Parameters.Add(sqlParameter1);
在C# Web服务中必须保证 pbillid 与存储过程中完全一致!
相关英文资料:
Data Access Application Block: Default Oracle cursor cur_OUT
The managed provider for Oracle requires you to explicitly bind your reference cursor in your parameter collection. This means you must explicitly create an output parameter for the cursor in your application code. However, that code will not be portable with database systems that do not require a parameter for the cursor. The OracleDatabase allows you to create commands without specifying a cursor. It will create a cursor, named cur_OUT, for commands that execute a stored procedure and do not include an output parameter for the cursor. This means that you can name your reference cursor as "cur_OUT" and the Data Access Application Block will bind it for you; you do not need to explicitly create an output parameter for the cursor. If your stored procedures use a cursor with a name other than "cur_OUT," you must explicitly add a parameter for each cursor to the command. Similarly, if your stored procedure contains multiple cursors, you must explicitly add each cursor parameter to the command.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/593324/viewspace-376136/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/593324/viewspace-376136/