ORA-06502: PL/SQL: numeric or value error: character string buffer too small exception from C# code

前端 未结 6 2235
暖寄归人
暖寄归人 2021-02-20 03:33

I am trying to execute some oracle pl/sql procedure with in and out parameters from # code on asp.net. I want to retrive the value from out parameter. but when I execute i am ge

6条回答
  •  忘了有多久
    2021-02-20 03:59

    Another strage thing we RAN into related to this is with Oracle functions, for the special ParameterDirection.ReturnValue (*** all the rest of the ParameterDirection will work)

    if you decalre it like bellow, directly in the constructor it DOSEN'T work:

    cmd.Parameters.Add(new OracleParameter("myretval", OracleDbType.Long, 10, ParameterDirection.ReturnValue));

    Result in error like:

    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-01403: no data found
    ORA-06512: at line 1
    

    if you declare it like this it works:

    OracleParameter retval = (new OracleParameter("myretval", OracleDbType.Long, 10);
                retval.Direction = ParameterDirection.ReturnValue;
                cmd.Parameters.Add(retval);
    

提交回复
热议问题