Joe Scoket
the quesion about the Oracle's Function return's name
By Joe Scoket in ADO.NET on Jul 02 2008
  • Joe Scoket
    Jul, 2008 2

    Thanks for you to interview my question. i just want to use the C# and Oracle 10g,now i need to get the Oracle's function result. I can open my source as blew: Oracle's source ---------------------------------- function getNextYYMM( varNowYYMM in varchar2 ) return varchar2 is varNowYY varchar2(4); varNowMM varchar2(2); varNxtYYMM varchar2(6); begin varNowYY := substr(varNowYYMM,1,4); varNowMM := substr(varNowYYMM,5,2); if varNowMM = '12' then varNxtYYMM := to_char(to_number(varNowYY) + 1) || '01'; else varNxtYYMM := varNowYY || trim(to_char(to_number(varNowMM) + 1,'00')); end if; return varNxtYYMM; end getNextYYMM; ---------------------------------- My C#'s Source as blow: ---------------------------------- public string Get_Proc() { string reStr; OracleCommand cmd; clsDBOpen(); cmd = new OracleCommand("CCMN001BAK.getNextYYMM", connCls); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("varNowYYMM", OracleDbType.Varchar2).Value = "20080607"; cmd.Parameters.Add("varNxtYYMM", OracleDbType.Varchar2, 6).Direction = ParameterDirection.ReturnValue; cmd.ExecuteNonQuery(); connCls.Close(); reStr = cmd.Parameters["varNxtYYMM"].Value.ToString(); return reStr; } -------------------------------- When i excute the code.i can not get the result. i have tested many times,now i am sure that the problem with the name of returnvalue.The name "varNxtYYMM" is wrong,The name "result" is wrong too. i do not know the real name when it use in C#. Pls tell me the reason. Thank you very much. if you can not understand what i said i will explain it step by step.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS