0

I got the function that returns me a varchar2.

I'm using dapper and I got a problem while executing this query.

OracleDynamicParameters DictionaryParams = new OracleDynamicParameters();

DictionaryParams.Add(name: "id", value: id,direction: ParameterDirection.Input);
DictionaryParams.Add(name: "Return_Value",oracleDbType: OracleDbType.Varchar2,direction: ParameterDirection.ReturnValue);

con.Execute("function_name", DictionaryParams, commandType: CommandType.StoredProcedure);

 string a;

 a = DictionaryParams.Get<string>("Return_Value");

And I got an Oracle error:

ORA-06502: PL/SQL: error number or value :character string buffer too small

I tried to give a size to a returning value but this didn't work, and I also tried to figure out but everything didn't worked.

Can someone take a look at this?

2
  • Have you tried uping the value for OracleDbType.Varchar2? Commented Sep 9, 2015 at 14:39
  • Could the error be in the procedure call itself? If you call the procedure directly from sqlplus, does it work? Commented Sep 9, 2015 at 14:53

2 Answers 2

2

You need to specify the max size of the varchar2.

Example:

parameters.Add("P_OUTPUT", dbType: OracleDbType.Varchar2, direction: ParameterDirection.Output, size: 1000);

Sign up to request clarification or add additional context in comments.

Comments

0

I suppose the problem originates from using Char which is a fixed length string.
Somewhere in your PL-SQL code you try to put a Char or varchar2 string of length N into a char of lengh M where M > N

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.