问题描述
在我的代码中出现以下错误。
ORA-06550:第1行第7列:
PLS-00306:调用的参数数量或类型错误''SAVE_DATA''
ORA-06550:第1行第7栏:
PL / SQL:声明被忽略
这是什么原因?
我用的代码是,
In my code am getting following error.
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to ''SAVE_DATA''
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
What will be the reason for this?
code am using is,
List<oracleparameter> listparamters = new List<oracleparameter>();
OracleParameter prm = null;
OracleParameter prm1 = null;
OracleParameter prm2 = null;
OracleParameter prm3 = null;
OracleParameter prm4 = null;
prm = new OracleParameter(Param, OracleType.VarChar);
prm1 = new OracleParameter(Param1, OracleType.VarChar);
prm2 = new OracleParameter(Param2, OracleType.VarChar);
prm3 = new OracleParameter(Param3, OracleType.VarChar);
prm4 = new OracleParameter(Param4, OracleType.VarChar);
prm.Value = "Test";
prm1.Value = "TRUE";
prm2.Value = "FALSE";
prm3.Value = "FALSE";
prm4.Value = "FALSE";
prm.Direction = ParameterDirection.Input;
prm 1.Direction = ParameterDirection.Input;
prm2.Direction = ParameterDirection.Input;
prm3.Direction = ParameterDirection.Input;
prm3.Direction = ParameterDirection.Input;
paramters.Add(prm);
paramters.Add(prm1);
paramters.Add(prm2);
paramters.Add(prm3);
paramters.Add(prm3);
OracleCommand command = objDataAccessUtilities.GetOracleCommand(SaveData, paramters);
objDataAccessUtilities.ExecuteDataReader(command);
程序:
Procedure:
PROCEDURE SAVE_DATA(
Value1 IN varchar2,
Value2 IN varchar2,
Value3 IN varchar2,
Value4 IN varchar2,
Value5 IN varchar2) IS
COUNT INTEGER;
BEGIN
Select count(Field_name) into COUNT from table1 where UPPER(Filed_name)=UPPER(Value1);
IF COUNT>0 THEN
update table1
SET
Field 2=Value2 ,
Field 3=Value2Value3 ,
Field 4=Value2Value4 ,
Field 5=Value2Value5 ,
where UPPER(Filed_name)=UPPER(Value1);
ELSE
INSERT INTO table1(
field,
field,
field,
field,
field,
field,
field,
field,
)
VALUES(
Value,
Value,,
Value,,
Value,,
Value,,
Value,,
SYSDATE,
USER
);
END IF;
commit;
EXCEPTION
WHEN OTHERS THEN
Rollback;
END SAVE_DATA;
推荐答案
//btw is "paramters" a typ-o ?
paramters.Add(prm3);
paramters.Add(prm3);
我会先尝试从数据库调用存储过程来检查是否存在工作,然后从代码中调用它。
PS:请确认您提供的代码与您使用的代码100%相同。在提供的代码中似乎有几种类型,这使得找到罪魁祸首更加困难。
希望这会有所帮助。
I would first try to call the Stored Procedure from the database to check if that works, then call it from code.
PS: Please verify that the code you provide here is 100% the same as the code you use. There seem to be several typ-o''s in the provided code, which makes it harder to find the culprit.
hope this helps.
这篇关于为什么会收到此错误? ORA-06550 PLS-00306的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!