当我试图将结果从存储过程传递到数据集时,会出现以下错误。OracleHelper类类似于SqlHelper,只是它引用了Oracle。
我使用的是ODP.NET托管驱动程序。
ACCOUNTS表中确实有示例数据。
错误:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'GET_ACCOUNT_DETAILSV2'
ORA-06550: line 1, column 7:
c#:
public DataSet GetUserData(string PHONE_NUMBER)
{
return (DataSet)OracleHelper.ExecuteDataset(GetConnectionString(), "GET_ACCOUNT_DETAILSV2", PHONE_NUMBER););
}
储存程序:
CREATE OR REPLACE PROCEDURE GET_ACCOUNT_DETAILSV2 (
PHONE_NUMBER IN ACCOUNTS.PHONE%TYPE,
o_rc OUT SYS_REFCURSOR)
IS
BEGIN
OPEN o_rc FOR
SELECT ID,
STATUS,
EMAIL
FROM ACCOUNTS
WHERE PHONE = PHONE_NUMBER;
END GET_ACCOUNT_DETAILSV2;
/
任何帮助都将不胜感激。
类似的东西:
using (OracleConnection conn = new OracleConnection("User Id=marketing;Password=SECRET;Data Source=dashworks-db"))
{
conn.Open();
using (OracleCommand cmd = new OracleCommand("GET_ACCOUNT_DETAILSV2", conn))
{
cmd.BindByName = true;
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("PHONE_NUMBER", "416-123-4567");
cmd.Parameters.Add("o_rc", OracleDbType.RefCursor, ParameterDirection.Output);
using (OracleDataAdapter adapter = new OracleDataAdapter(cmd))
{
DataSet ds = new DataSet("result");
ds.Locale = CultureInfo.InvariantCulture;
adapter.Fill(ds);
}
}
}