473,503 Members | 5,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PLS-00306 Wrong number of types of arguments in call to 'Stored Procedure' {Pls help}

3 New Member
I am getting this error when I call a stored procedure from my C# code. It is a simple stored procedure with six params that inserts data :

PROCEDURE LHD_SUR_ADMNEXP_HDR_INS (
p_ORG_ID Varchar,
p_YEAR Varchar,
p_DATA_NOT_APPLICABLE_ADMNEXP Number,
p_DATA_NOT_APPLICABLE_OPENENR Number,
P_VALDN_EXCEPN_MSG varchar,
p_RETVAL OUT NUMBER
)
IS

REQUIRED EXCEPTION;
BEGIN
If (p_ORG_ID IS NULL) OR Length(p_ORG_ID) = 0 Then
Raise REQUIRED;
End If;

If (p_YEAR IS NULL) OR Length(p_YEAR) = 0 Then
Raise REQUIRED;
End If;

insert into lhd_sur_admn_opnenr_exp_hdr
(org_id,
year,
data_not_applicable_admexp,
data_not_applicable_opnenr,
valdn_excepn_msg)
values
(p_org_id,
p_year,
p_DATA_NOT_APPLICABLE_ADMNEXP,
p_DATA_NOT_APPLICABLE_OPENENR,
p_valdn_excepn_msg
);

p_retval := 1;

EXCEPTION
WHEN REQUIRED THEN --params missing
p_RETVAL := -999;
WHEN NO_DATA_FOUND THEN --data not found
p_RETVAL := -100;

END LHD_SUR_ADMNEXP_HDR_INS;
************************************************** ****
And here is the C# code
Cmd.Parameters.Clear() 'Initialize Parameters collection
Cmd.Parameters.Add(New OracleParameter("p_ORG_ID", OracleType.VarChar, 22)).Value = clsLHSurveyCommon.gOrgid '"11568" '
Cmd.Parameters(0).Direction = ParameterDirection.Input

Cmd.Parameters.Add(New OracleParameter("p_YEAR", OracleType.VarChar, 4)).Value = clsLHSurveyCommon.gPlanYear '"2009" '
Cmd.Parameters(1).Direction = ParameterDirection.Input

Cmd.Parameters.Add(New OracleParameter("p_DATA_NOT_APPLICABLE_ADMNEXP", OracleType.Int16, 1)).Value = Convert.ToInt16(chkDataNotApplicableAdmnExp.Checke d)
Cmd.Parameters(2).Direction = ParameterDirection.Input

Cmd.Parameters.Add(New OracleParameter("p_DATA_NOT_APPLICABLE_OPENENRL", OracleType.Int16, 1)).Value = Convert.ToInt16(chkDataNotApplicableOpenEnrl.Check ed)
Cmd.Parameters(3).Direction = ParameterDirection.Input

Cmd.Parameters.Add(New OracleParameter("P_EXCEPTION_MESSAGE", OracleType.VarChar, 500)).Value = IIf(Not (String.IsNullOrEmpty(txtExceptionMessage.Text)), txtExceptionMessage.Text, System.DBNull.Value)
Cmd.Parameters(4).Direction = ParameterDirection.Input

Cmd.Parameters.Add(New OracleParameter("p_RETVAL", OracleType.Float, 4)).Direction = ParameterDirection.Output

Cmd.ExecuteNonQuery()

************************************************** ***
I am not sure if the column types of the destination table matter, but here is that info as well.
"ORG_ID" VARCHAR2(22) NOT NULL ENABLE,
"YEAR" VARCHAR2(4) NOT NULL ENABLE,
"DATA_NOT_APPLICABLE_ADMEXP" NUMBER(1,0),
"VALDN_EXCEPN_MSG" VARCHAR2(500),
"DATA_NOT_APPLICABLE_OPNENR" NUMBER(1,0),

Any help would be really appreciated, as I have spent several hours on this error and cannot seem to figure it out.

This question has also been asked on this website before, but it does not have any solution to it.
http://bytes.com/topic/c-sharp/answers/260973-problem-when-accessing-oracle-procedure-varchar2#
Jan 4 '10 #1
5 8561
Plater
7,872 Recognized Expert Expert
Cmd is an oracle command object with the command type set to stored procedure?
Jan 4 '10 #2
kaushal30
3 New Member
Yes, ... Command is a System.Data.OracleClient.OracleCommand object, and the type is set to Stored procedure.
Jan 4 '10 #3
Plater
7,872 Recognized Expert Expert
I am not sure what to suggest, I have heard of this trouble before.

You could try making a new stored procedure that only takes one parameter and see if you can get that working, then keeping adding parameters to the storedproc untill you can no longer make it work in code?
Jan 5 '10 #4
kaushal30
3 New Member
Plater, Your suggestion was brilliant. Thanks so much.

It helped me narrow down the problem to two parameters that were the cause of the issue. You would not believe, it was the name of those two parameters (3rd and 4th parameters are not named exactly as in the signature of the Stored Procedure). Oracle 10i is definitely throwing a wrong description of the error, partly to blame.

The second conclusion is also that Oracle.DataAccess.Client is not sensitive to parameter names. Initially we were using this version and I was not getting these errors and saving successfully to the DB. Only after changing to System.Data.OracleClient, this issue surfaced. Thanks again.
Jan 5 '10 #5
Sourabh4u
1 New Member
@Plater
I also had same problem. I have tried following code to create parameter to command object. Its working.. i guess there are few incompatibility between .net & oracle. Oracle sometime cant recognize the parameters..


OleDbParameter param = new OleDbParameter();
param.ParameterName = "TPSG_ID1";
param.Value = Int32.Parse(trvMnu.SelectedNode.Value);
param.Direction = ParameterDirection.Input;
param.OleDbType = OleDbType.Integer;
DBCmd.Parameters.Add(param);
Jan 4 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
7997
by: Java Guy | last post by:
I'm trying to view a web page. IE tells me there are (Java?) errors on the page. Here they are: Line: 15 Char: 7 Error: Wrong number of arguments or invalid propert assignment Code: 0 URL:...
6
20493
by: tinareed | last post by:
Please help out a newbie. I've copied a complicated query and am trying to modify it for mailing labels. First, last name and primary address are the fields. Primary address would be either a home...
1
3040
by: alhalayqa | last post by:
hi guys, I have XML node object o,and I am trying to know if getAttribute is a function in the object o, by using if(typeof o.getAttribute == 'function'), now firefox returns "function", but IE...
3
9011
by: vunet | last post by:
Hello, I've just installed ASPXMLRPC library and testing their main function: xmlRPC ("URL", "command_name", params) The function converts all parameters to XML, sends a request to third-...
2
1249
by: Deven Oza | last post by:
Create PROCEDURE NextGen_ConvertDate_Deven AS declare @DLSStart smalldatetime set @DLSStart = (select dbo.fn_GetDaylightSavingsTimeStart(convert(varchar,datepart(year,getdate())))) /* please...
3
7652
akashazad
by: akashazad | last post by:
Hi Friends My question is "can we call Stored Procedure from a User Defined Function in SQL" If yes then pl tell me how? If No then pl tell me why not ? While I was trying finding...
2
3552
by: Steven Hayes | last post by:
Thanks for any help I'm new at this. I have the following excel statement: =IF(B131="", "Input UFMIP", IF((B131-B133)<0, 0, IF(B131>0, B131-B133, 0))) I tried unsuccessfully to convert to...
2
4828
by: Dave Smith | last post by:
Hi everyone again. I’m working on making my database roll with each month that changes. Below is what I have so far, and was hoping someone could help me with the rest. The error message I’m...
0
4262
by: Peter Moh | last post by:
I get wrong number of arguments (0 for 1) error. The create action works with regular validates but authenticate/salt processing. Please point out what does the message mean? The create...
0
7188
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7063
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7313
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
4987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1489
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.