Skip to Main Content
  • Questions
  • raise_application_error gives ORA-06502: PL/SQL: numeric or value error: character string

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Piush.

Asked: March 10, 2016 - 3:01 pm UTC

Last updated: March 11, 2016 - 1:38 am UTC

Version: 12.1.0.2.0

Viewed 1000+ times

You Asked

I was just trying to run a simple raise_application_error but i get (SQL-ERROR:-6502 - ORA-06502: PL/SQL: numeric or value error: character string buffer too small) along with the error message

DECLARE
BEGIN
Raise_Application_Error (-20343, 'The balance is too low.');
END;


output
SQL-ERROR:-6502 - ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-20343: The balance is too low.
ORA-06512: at line 3

and Connor said...

I can't reproduce here

SQL> select * from v$version;

BANNER
-----------------------------------------------------------------------------
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
PL/SQL Release 12.1.0.2.0 - Production
CORE    12.1.0.2.0      Production
TNS for 64-bit Windows: Version 12.1.0.2.0 - Production
NLSRTL Version 12.1.0.2.0 - Production


SQL> DECLARE
  2  BEGIN
  3  Raise_Application_Error (-20343, 'The balance is too low.');
  4  END;
  5  /
DECLARE
*
ERROR at line 1:
ORA-20343: The balance is too low.
ORA-06512: at line 3


Is it possible you have a "ON SERVERERROR" trigger defined ? If *that* is failing, you'd then see the recursive error you're seeing.

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library