问题描述
存储过程代码如下:createorreplaceprocedureGetID(/*以此字符为自增长名*/vcTableIDinvarchar,/*初始化*/vcIniStateinvarchar,/*需增长数量*/iCountininteger,/*没有指定TableID是否创建true创建false不创建*/blCreateinboolean,/*返回起始值*/iValueoutinteger,/*命令执行是否成功0成功1参数错误2没有指定TableID*/iRetvaloutinteger)is/*定义变量*/vcStatevarchar(10);iRowCountnumber;iStepnumber;iIniValuenumber;beginiRetval:=99;if((vcTableIDisnull)or(length(vcTableID)=0)or(iCount<1))theniRetval:=1;rollback;return;endif;updatePub_Sequencesetvalue=valuewhereTableID=vcTableID;iRowCount:=sql%rowcount;if(iRowCount=1)thenselectValue,IniState,Step,IniValueintoiValue,vcState,iStep,iIniValuefromPub_SequencewhereTableID=vcTableID;if(vcIniStateisnullorlength(vcIniState)=0)thenupdatePub_SequencesetValue=Value+iCountwhereTableID=vcTableID;elsif(vcState=vcIniState)thenupdatePub_SequencesetValue=Value+iCountwhereTableID=vcTableID;elsif(vcState!=vcIniState)thenupdatePub_SequencesetValue=iIniValue+iCountwhereTableID=vcTableID;iValue:=0;endif;elsif(iRowCount=0)thenif(blCreate)theninsertintoPub_Sequence(Tableid,Value,Inivalue,Inistate,Step,Datastate,Testdata)values(vcTableID,iCount,0,'',1,0,0);iValue:=0;elseiRetval:=2;endif;endif;commit;iRetval:=0;exceptionwhenothersthenrollback;iRetval:=99;return;endGetID;
程序代码:Databasedb=DatabaseFactory.CreateDatabase();DbCommanddbCommand=db.GetStoredProcCommand("GetID");db.AddInParameter(dbCommand,"vcTableID",DbType.String,tableId);db.AddInParameter(dbCommand,"vcIniState",DbType.String,string.Empty);db.AddInParameter(dbCommand,"iCount",DbType.Int64,count);db.AddInParameter(dbCommand,"blCreate",DbType.Boolean,1);db.AddOutParameter(dbCommand,"iValue",DbType.Int32,32);db.AddOutParameter(dbCommand,"iRetval",DbType.Int32,32);db.ExecuteNonQuery(dbCommand);result=db.GetParameterValue(dbCommand,"iRetval").ToString();
存储过程肯定没有问题,但是在程序中执行就会出现错误:错误如下:ORA-06550:第1行,第7列:PLS-00306:调用'GETID'时参数个数或类型错误ORA-06550:第1行,第7列:PL/SQL:Statementignored请问该如何解决啊。。。。。。。。谢谢
解决方案
解决方案二:
updatePub_Sequencesetvalue=valuewhereTableID=vcTableID;--value=value什么意思?iValueoutinteger,iRetvaloutinteger--两个输出值result=db.GetParameterValue(dbCommand,"iRetval").ToString();--一个结果--类型定义的也不好--把int改成number--把string改成varchar
解决方案三:
--以此字符为自增长名--自动增长用序列呀