当我尝试将结果从存储过程传递到数据集时,出现以下错误。 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;
/
任何帮助将不胜感激。
答案 0 :(得分:0)
类似的东西:
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);
}
}
}