I have a procedure in a package. there is an out variable p_return_msg VARCHAR2.
right after the BEGIN I have p_return_msg := 'Validation successful.'
this causes ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at "ZWR5KFR.PRICING_AUDIT_PKG", line 187 ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at "ZWR5KFR.PRICING_AUDIT_PKG", line 134 ORA-06512: at line 1
line 134 is that line and 187 is in the exception section where I'm trying to assign something to it again. p_return_msg := 'Validation failed: '
if I change the line to p_return_msg := ''; that works until at any point I try to assign anything to it then I get the error again.
I've tried using a temp var and just assign that to it, but same error. Nothing I've tried or could find online seems to help.
EDIT: I think I figured it out. The person calling my procedure doesn't have the variable in C# set up properly to accept a value. They have not confirmed the code I sent them to get the variable properly.
var pReturnMsg = new OracleParameter("p_return_msg", OracleDbType.Varchar2, 4000) { Direction = ParameterDirection.Output };
It is not the package to blame, but variable that accepts procedure's OUT parameter's value.
Sample procedure:
See
l_msg's declaration; 5 characters is just too short!But, if we enlarge it, everything is OK: