而在C#Geeting錯誤ORA-01036,同時使用C#執行Oracle過程
,這是我的C#代碼粘貼低於本有30場,我要插入到數據庫中執行Oracle過程即時得到錯誤
OracleCommand orclCMD = new OracleCommand();
orclCMD.Connection = CGlobalVariable.orclDB.opneCon();
orclCMD.CommandText = "SPKFIL_HPT_SPECTRO";
orclCMD.CommandType = CommandType.StoredProcedure;
orclCMD.Parameters.Add("P_AMPLE_TASK ", OracleType.VarChar).Value = SAMPLE_TASK;
orclCMD.Parameters.Add("P_TSK_TYPE", OracleType.VarChar).Value = TSK_TYPE;
orclCMD.Parameters.Add("P_PRG", OracleType.VarChar).Value = PRG;
orclCMD.Parameters.Add("P_TYPE_STD", OracleType.VarChar).Value = TYPE_STD;
orclCMD.Parameters.Add("P_QUALITY", OracleType.VarChar).Value = QUALITY;
orclCMD.Parameters.Add("P_SAMPLE_DATE", OracleType.DateTime).Value = SAMPLE_DATE;
orclCMD.Parameters.Add("P_SAMPLE_TIME", OracleType.VarChar).Value = SAMPLE_TIME;
orclCMD.Parameters.Add("P_SID1", OracleType.VarChar).Value = SID1;
orclCMD.Parameters.Add("P_SID2", OracleType.VarChar).Value = SID2;
orclCMD.Parameters.Add("P_SID3", OracleType.VarChar).Value = SID3;
orclCMD.Parameters.Add("P_SID4", OracleType.VarChar).Value = SID4;
orclCMD.Parameters.Add("P_SID5", OracleType.VarChar).Value = SID5;
orclCMD.Parameters.Add("P_SID6", OracleType.VarChar).Value = SID6;
orclCMD.Parameters.Add("P_SID7", OracleType.VarChar).Value = SID7;
orclCMD.Parameters.Add("P_SID8", OracleType.VarChar).Value = SID8;
orclCMD.Parameters.Add("P_SID9", OracleType.VarChar).Value = SID9;
orclCMD.Parameters.Add("P_SID10", OracleType.VarChar).Value = SID10;
orclCMD.Parameters.Add("P_SAMPLE_TYPE", OracleType.Number).Value = SAMPLE_TYPE;
orclCMD.Parameters.Add("P_C_2", OracleType.Double).Value = C_2;
orclCMD.Parameters.Add("P_SI1", OracleType.Double).Value = SI1;
orclCMD.Parameters.Add("P_MN3", OracleType.Double).Value = MN3;
orclCMD.Parameters.Add("P_S", OracleType.Double).Value = S;
orclCMD.Parameters.Add("P_P_1", OracleType.Double).Value = P_1;
orclCMD.Parameters.Add("P_CU5", OracleType.Double).Value = CU5;
orclCMD.Parameters.Add("P_CR1", OracleType.Double).Value = CR1;
orclCMD.Parameters.Add("P_PB", OracleType.Double).Value = PB;
orclCMD.Parameters.Add("P_SN2", OracleType.Double).Value = SN2;
orclCMD.Parameters.Add("P_TI4", OracleType.Double).Value = TI4;
orclCMD.Parameters.Add("P_CE", OracleType.Double).Value = CE;
orclCMD.Parameters.Add("P_MO2", OracleType.Double).Value = MO2;
int i = orclCMD.ExecuteNonQuery();
而我這裏是Oracle的程序代碼
CREATE OR REPLACE Procedure SPKFIL_HPT_SPECTRO
(
P_SAMPLE_TASK VARCHAR2,
P_TSK_TYPE VARCHAR2,
P_PRG VARCHAR2,
P_TYPE_STD VARCHAR2,
P_QUALITY VARCHAR2,
P_SAMPLE_DATE DATE,
P_SAMPLE_TIME VARCHAR2,
P_SID1 VARCHAR2,
P_SID2 VARCHAR2,
P_SID3 VARCHAR2,
P_SID4 VARCHAR2,
P_SID5 VARCHAR2,
P_SID6 VARCHAR2,
P_SID7 VARCHAR2,
P_SID8 VARCHAR2,
P_SID9 VARCHAR2,
P_SID10 VARCHAR2,
P_SAMPLE_TYPE NUMBER,
P_C_2 NUMBER,
P_SI1 NUMBER,
P_MN3 NUMBER,
P_S NUMBER,
P_P_1 NUMBER,
P_CU5 NUMBER,
P_CR1 NUMBER,
P_PB NUMBER,
P_SN2 NUMBER,
P_TI4 NUMBER,
P_CE NUMBER,
P_MO2 NUMBER)
As
cnt number;
Begin
select nvl(count(P_SAMPLE_TYPE),0) into cnt from KFIL_HPT_SPECTRO where SAMPLE_TYPE=P_SAMPLE_TYPE;
if cnt=0 then
insert into KFIL_HPT_SPECTRO (SAMPLE_TASK,TSK_TYPE,PRG,TYPE_STD,QUALITY,SAMPLE_DATE,SAMPLE_TIME,SID1,
SID2,SID3,SID4,SID5,SID6,SID7,SID8,SID9,SID10,SAMPLE_TYPE,C_2, SI1, MN3,S,p_1, CU5,CR1, PB, SN2,TI4, CE, MO2)
Values
(P_SAMPLE_TASK,P_TSK_TYPE,P_PRG,P_TYPE_STD,P_QUALITY,P_SAMPLE_DATE,P_SAMPLE_TIME,P_SID1,P_SID2,P_SID3,P_SID4,
P_SID5,P_SID6,P_SID7,P_SID8,P_SID9,P_SID10,P_SAMPLE_TYPE,P_C_2,P_SI1,P_MN3,P_S,P_P_1,P_CU5,P_CR1,P_PB,P_SN2,
P_TI4,P_CE,P_MO2);
else
Update KFIL_HPT_SPECTRO set SAMPLE_TASK = P_SAMPLE_TASK,TSK_TYPE = P_TSK_TYPE,PRG = P_PRG ,TYPE_STD = P_TYPE_STD ,QUALITY = P_QUALITY ,
SAMPLE_DATE = P_SAMPLE_DATE ,SAMPLE_TIME = P_SAMPLE_TIME ,SID1 = P_SID1 ,SID2 = P_SID2 ,SID3 = P_SID3 ,
SID4 = P_SID4 ,SID5 = P_SID5 ,SID6 = P_SID6 ,SID7 = P_SID7 ,SID8 = P_SID8 ,SID9 = P_SID9 ,
SID10 = P_SID10 ,C_2 = P_C_2 , SI1 = P_SI1 , MN3 = P_MN3 ,S = P_S ,p_1 = P_P_1 , CU5 = P_CU5 ,CR1 = P_CR1 ,
PB = P_PB , SN2 = P_SN2 ,TI4 = P_TI4 , CE = P_CE , MO2 = P_MO2
Where SAMPLE_TYPE = P_SAMPLE_TYPE ;
end if;
end;
獲取ORA-01036錯誤代碼時執行ExecuteNonQuery()
代碼。 請幫我提前和thnx
對不起m在這裏如果你知道ans請告訴我 – Tanmay
首先檢查你是否有30場和30個值 – tharif
是dr r所有30場和值 – Tanmay