troubleshooting Question

Problem with To_Char string overflow (6502) error

Avatar of jrcooperjr
jrcooperjr asked on
Oracle Database
7 Comments1 Solution608 ViewsLast Modified:
I've condensed my problem into a very simple procedure.  Here is the procedure:

    iunique         integer;
    vfour           varchar2(4);
    vfive           varchar2(5);
   iunique := 1330    ;
   vfive := to_char(iunique,'0009') ;
   vfour:= to_char(iunique,'0009') ;
END test;

When I execute this procedure, I get a 6502 error on the line using the to_char function with vfour.  The to_char line with vfive gives no error.

As I interpret things, I am converting a four-digit integer value to characters.  This should give me a four-character result.  

Shouldn't the four-character result fit in a four-character field?  

Any explanations as to why I'm getting the 6502 error when I'm trying to put the result in a four-character field, but no error when I put the result in a five character field?

(We're using Oracle 11g by the way)
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros