plsqlbufferbind-variablesora-06502

Accessing Bind Variable in PL/SQL


I am trying to run a program in the Oracle express edition editor. When I execute the program, I get an error

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

Can anyone help me understand why I am getting an error and how to fix the code?

VARIABLE gvn_total_salary NUMBER;
DECLARE
   vn_base_salary NUMBER := 3000;
   vn_bonus NUMBER := 1000;
BEGIN
   :gvn_total_salary := vn_base_salary + vn_bonus;
END;

The output I'm getting

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


Run By SYSTEM 
Parsing Schema SYSTEM 
Script Started Thursday, April 26, 2012 
 3 seconds ago 
Elapsed time 0.01 seconds 
Statements Processed 1 
Successful 0 
With Errors 1 

Solution

  • What are you actually trying to accomplish? This script won't execute in sqlplus or Oracle Developer or any PL/SQL execution environment I can think of. In fact, I don't understand how you are passing the bind variable :gvn_total_salary and how you can get the error you are describing. You should get something like "bind variable gvn_total_salary" not declared.