fbpx

ORA-06502: PL/SQL: numeric or value error

VijayaTech Labs Blog
Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp
We may get this error, when we try to assign a value to a variable which is bigger than the maximum size of the variable.
Find the following code for example:

DECLARE

v_data      VARCHAR2(1);

BEGIN

v_data := ‘YES’;

END;

/

Error starting at line : 1 in command –
DECLARE
v_data      varchar2(1);
BEGIN
v_data := ‘YES’;
END;
Error report –
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 4
06502. 00000 –  “PL/SQL: numeric or value error%s”
*Cause:  
*Action:

Analysis:
The above error is because, we declared v_data as VARCHAR2 with maximum size of 1 BYTE, but we tried to assign a value of 3 BYTE. That is why we have got error.

Solution:
Increase the size of the v_data to maximum size of the data to atleast to 3 BYTE.

Share this post with your friends

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on skype
Share on telegram
Share on whatsapp
Share on email

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top