首页 > 代码库 > ORA-06502:PL/SQL :numberic or value error: character string buffer too small

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

今天遇到一个错误提示:ORA-06502:PL/SQL :numberic or value error: character string buffer too small,一般对应的中文信息为:ORA-06502: PL/SQL: 数字或值错误 :字符串缓冲区太小。仔细检查调试过程中才发现是开发人员定义了一个变量,但是在脚本里面赋予了该变量超过其长度的值。

比如:

 1: DECLARE

   2:  

   3: c VARCHAR2(3 CHAR);

   4:  

   5: BEGIN

   6:  

   7: c := ‘abc ‘;

   8:  

   9: END;

  10:  

  11: /

  12:  

  13: Result:

  14:  

  15: DECLARE

  16:  

  17: *

  18:  

  19: ERROR at line 1:

  20:  

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

  22:  

  23: ORA-06512: at line

 

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