plsql numeric value error while calling the oracle function from C# - please tell me how to remove that error.
PL/SQL: numeric or value error: character string buffer too small
Code:
create or replace function testdotnet(h1 varchar2)
return varchar2
as
x varchar2(250);
begin
select 'hello' into x from dual;
return x;
end;
C# code:
string CommandStr = "APPS.testdotnet";
using (OracleConnection conn = new OracleConnection("User Id=apps;Password=***;Data Source=***"))
using (OracleCommand cmd = new OracleCommand(CommandStr, conn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("h1", OracleDbType.Varchar2).Value = "aaa";
cmd.Parameters.Add("x", OracleDbType.Varchar2, 40000).Direction = ParameterDirection.ReturnValue;
cmd.Parameters["x"].Size = 255;
cmd.Parameters["h1"].Size = 255;
conn.Open();
cmd.ExecuteNonQuery();
Response.Write( cmd.Parameters["x"].Value.ToString());
}