I get this error when trying to call the update stored procedure from the gridview event handler:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'MMAR_SP_APPLICATION_UPDATE'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Stored proc:
CREATE OR REPLACE PROCEDURE RPT.MMAR_SP_Application_Update
(
application_id_ IN MMAR_application.application_id%TYPE,
name_ IN MMAR_application.name%type,
lob_ IN mmar_application.lob%type,
region_ IN mmar_application.region%type,
cvscodelocation_ IN mmar_application.cvscodelocation%type,
description_ IN mmar_application.description%type
)
AS
BEGIN
UPDATE MMAR_APPLICATION
SET
name=name_,
lob=lob_,
REGION=region_,
CVSCODELOCATION=cvscodelocation_,
DESCRIPTION=description_,
USER_UPDATED=USER,
DATE_UPDATED=SYSDATE
WHERE APPLICATION_ID = application_id_;
COMMIT;
END MMAR_SP_Application_Update;
C# Code:
protected void gvApplication_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridView gv = (GridView)sender;
GridViewRow gvr = (GridViewRow)gv.Rows[e.RowIndex];
TextBox temp = new TextBox();
Label tempLbl = new Label();
OracleConnection conn = new OracleConnection("Data Source=xxx;Persist Security Info=True;User ID=xxx;Password=xxx");
conn.Open();
OracleCommand cmd = new OracleCommand("MMAR_SP_APPLICATION_UPDATE", conn);
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter prm6 = new OracleParameter("application_id_", OracleDbType.Int64);
prm6.Direction = ParameterDirection.Input;
tempLbl = (Label)gvr.FindControl("Label1");
prm6.Value = tempLbl.Text;
cmd.Parameters.Add(prm6);
OracleParameter prm1 = new OracleParameter("name_", OracleDbType.Varchar2);
prm1.Direction = ParameterDirection.Input;
temp = (TextBox)gvr.FindControl("Textbox1");
prm1.Value = temp.Text;
cmd.Parameters.Add(prm1);
OracleParameter prm2 = new OracleParameter("lob_", OracleDbType.Varchar2);
prm2.Direction = ParameterDirection.Input;
temp = (TextBox)gvr.FindControl("Textbox2");
prm2.Value = temp.Text;
cmd.Parameters.Add(prm2);
OracleParameter prm4 = new OracleParameter("region_", OracleDbType.Varchar2);
prm4.Direction = ParameterDirection.Input;
temp = (TextBox)gvr.FindControl("Textbox3");
prm4.Value = temp.Text;
cmd.Parameters.Add(prm4);
OracleParameter prm3 = new OracleParameter("cvscodelocation_", OracleDbType.Varchar2);
prm3.Direction = ParameterDirection.Input;
temp = (TextBox)gvr.FindControl("Textbox4");
prm3.Value = temp.Text;
cmd.Parameters.Add(prm3);
OracleParameter prm5 = new OracleParameter("description_", OracleDbType.Varchar2);
prm5.Direction = ParameterDirection.Input;
temp = (TextBox)gvr.FindControl("Textbox5");
prm5.Value = temp.Text;
cmd.Parameters.Add(prm5);
cmd.ExecuteNonQuery();
conn.Close();
gvApplication.DataBind();
}
Any idea why I keep getting this error no matter what I try?
Loading
Jorge L FernandezPosted Nov 5, 2009, 1:39 PM
This usually happens when there is a missmatch of parameters names or data types. By looking you code every parameter is well written and by ckecking your OracleDataTypes enum I see that every is VarChar2 except the "application_id_" parameter which is Int64. However the value you are asigning is a String (tempLbl.Text) so, try assigning Int64.Parse(tempLbl.Text) instead. So far the compiler has not does not complained since the Value property is an object.
Also make sure the rest of parameters in the SP are defined as Varchar2 as well.
If this solve your problem please mark this question answered by this reply.
Thanks
Jorge L