LadyDragon
Programmer
I am experiencing problems using ADO to run my Oracle function within a C# program. I am able to run the function just fine in oracle, but when running it via ADO, I consistently get the following msg:
Error MSG:
ORA-06550: line 1, column 18:\nPLS-00306: wrong number or types of arguments in call to 'POP_MO_ACCR'\n
ORA-06550: line 1, column 7:\nPL/SQL: Statement ignored\n
I do not know whether it is because I have incorrectly set the parameters or not - this function was working fine prior to the addition of the "percentage" parameter. I have verified that all the passed parameters actually have values and appear to be the correct type.
I'm going a bit nuts on this! I've looked through the forums, but wasn't able to find a specific enough issue that helped me, so I'm hoping someone out there can help me on this.
Thanks a bunch in advance!
Juls
PS - I've tried this with and without the p_edate parameter which has a default of NULL in the PLSQL function. Same error either way.
Error MSG:
ORA-06550: line 1, column 18:\nPLS-00306: wrong number or types of arguments in call to 'POP_MO_ACCR'\n
ORA-06550: line 1, column 7:\nPL/SQL: Statement ignored\n
I do not know whether it is because I have incorrectly set the parameters or not - this function was working fine prior to the addition of the "percentage" parameter. I have verified that all the passed parameters actually have values and appear to be the correct type.
I'm going a bit nuts on this! I've looked through the forums, but wasn't able to find a specific enough issue that helped me, so I'm hoping someone out there can help me on this.
Thanks a bunch in advance!
Juls
PS - I've tried this with and without the p_edate parameter which has a default of NULL in the PLSQL function. Same error either way.
Code:
//Call from aspx.cs page:
//declarations
string edt = "1/31/2004";
DateTime x = Convert.ToDateTime(edt);
string node_id="274";
string scenarioName="My Scenario";
int pct = 50;
//call
ans.RecalculateAccrual(x,node_id,scenarioName.ToUpper(), pct);
//C# Function using ADO:
public void RecalculateAccrual(DateTime beginning_date, string node_id, string scenario_name, int percentage)
{
OracleConnection sqlcon = null;
try
{
sqlcon = new OracleConnection(m_connectionString);
sqlcon.Open();
OracleCommand cnCommand = new OracleCommand();
cnCommand.Connection = sqlcon;
cnCommand.CommandText ="ves.ves_monthly.POP_MO_ACCR";
cnCommand.CommandType = CommandType.StoredProcedure;
OracleParameter[] parms =
{
new OracleParameter("P_BDATE",OracleType.DateTime),
new OracleParameter("P_NODE_ID",OracleType.VarChar,15),
new OracleParameter("P_SNAME",OracleType.VarChar,30),
new OracleParameter("P_PCT",OracleType.Number),
new OracleParameter("retVal",OracleType.VarChar,255)
};
parms[0].Direction = ParameterDirection.Input;
parms[0].Value = beginning_date;
parms[1].Direction=ParameterDirection.Input;
parms[1].Value = node_id;
parms[2].Direction = ParameterDirection.Input;
parms[2].Value = scenario_name;
parms[3].Direction = ParameterDirection.Input;
parms[3].Value = percentage;
parms[4].Direction = ParameterDirection.ReturnValue;
cnCommand.Parameters.Add(parms[0]);
cnCommand.Parameters.Add(parms[1]);
cnCommand.Parameters.Add(parms[2]);
cnCommand.Parameters.Add(parms[3]);
cnCommand.Parameters.Add(parms[4]);
cnCommand.ExecuteNonQuery();
//PL/SQL Function
FUNCTION pop_mo_accr (p_bdate DATE, p_node_id VARCHAR2
, p_sname VARCHAR2 ,p_accr_adj_pct NUMBER DEFAULT 100.00
, p_edate DATE DEFAULT NULL
) RETURN VARCHAR2