这是我的程序,它通过 PL/SQL Developer 工作:
create or replace procedure CHECK_INFO_INS
(
p_id_aircraft IN VARCHAR2,
p_id_check_type IN NUMBER,
p_last_check IN DATE,
p_next_check IN DATE,
p_expectedcost IN NUMBER,
p_id_currency IN NUMBER,
p_currency_rate IN NUMBER
)
is
Rate number;
CurrentDate Date;
catID Checkcategories.Id%type;
begin
select C.ID into catID from CHECKCATEGORIES C WHERE C.NAME='C' and C.CHECKTYPEID = p_id_check_type;
Rate:=round(p_expectedcost/MONTHS_BETWEEN(p_next_check, p_last_check),3)*p_currency_rate;
CurrentDate := SYSDATE;
INSERT INTO CHECK_INFO
(
id_check_info,
id_aircraft,
id_check_categories,
last_check,
next_check,
expectedcost,
is_accumulation_complited,
rate,
id_currency,
current_date,
monthes_between,
CURENCY_RATE
)
values
(
CHECKS_INFO_SEQ.NEXTVAL,
p_id_aircraft,
catID,
p_last_check,
p_next_check,
p_expectedcost,
0,
Rate,
p_id_currency,
CurrentDate,
round(MONTHS_BETWEEN(p_next_check, p_last_check),1),
p_currency_rate
);
commit;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
ROLLBACK;
end CHECK_INFO_INS;
这是我的 C# 代码:
decimal expectedCost = Decimal.Parse(ExpCostTextBox.Text);
DateTime lastCheck = DateTime.Parse(LastCheckdateTimePicker.Text);
DateTime nextCheck = DateTime.Parse(NextCheckdateTimePicker.Text);
int checkType = int.Parse(ChCmbx.SelectedValue.ToString());
string AirCraft = AirCraftCmbx.SelectedValue.ToString();
int curID = int.Parse(CurrComboBox.SelectedValue.ToString());
decimal curRate = decimal.Parse(CurRateTextBox.Text.Replace('.',','));
con = new OracleConnection(conStr);
con.Open();
cmd = con.CreateCommand();
cmd.BindByName = true;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = schema_name + ".CHECK_INFO_INS";
cmd.Parameters.Add("p_id_aircraft", OracleDbType.NVarchar2, AirCraft, ParameterDirection.Input);
cmd.Parameters.Add("p_id_check_categories", OracleDbType.Int32, checkType, ParameterDirection.Input);
cmd.Parameters.Add("lastCheck", OracleDbType.Date, lastCheck, ParameterDirection.Input);
cmd.Parameters.Add("nextCheck", OracleDbType.Date, nextCheck, ParameterDirection.Input);
cmd.Parameters.Add("p_expectedcost", OracleDbType.Decimal, expectedCost, ParameterDirection.Input);
cmd.Parameters.Add("p_id_currency", OracleDbType.Int32, curID, ParameterDirection.Input);
cmd.Parameters.Add("p_currency_rate", OracleDbType.Decimal, curRate, ParameterDirection.Input);
cmd.ExecuteNonQuery();
它在 executeNonQuery 行上引发异常:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'CHECK_INFO_INS'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
我试图重新创建该过程,但它不起作用。我的 C# 代码有什么问题?