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


執行存儲過程中報如下錯誤:ORA-06502: PL/SQL: numeric or value error: character string buffer too small

經過排查,發現是由於賦予變量的值超過了變量定義的長度。

定義的字符變量長度為3位:

v_operator_1  varchar2(3);

實際上賦予變量的值threshold_operator中有多余的兩位空格字符,導致實際字符大於了3位:

select threshold_operator, threshold_value into v_operator_1, f_threshold_1 from t_conf_threshold where kpi_id = 101001000100;

解決方法是修改變量定義的長度,或者剔除字段中的空值,如下:

select rtrim(ltrim(threshold_operator)), threshold_value into v_operator_1, f_threshold_1 from t_conf_threshold where kpi_id = 101001000100;

綜上,我們在定義變量的時候一定要注意其長度是否滿足需要,或者在取值的時候盡量要剔除空格字符。

 

----END;




免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM