INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

ORA-06502 character string buffer too small

ORA-06502 character string buffer too small

(OP)
I have this piece of code (I hope I copied enough of it):

CODE

f_in      utl_file.file_type;
  s_in      varchar2(10000);
  string    varchar2(32000);
  x         XMLType;
BEGIN
    -- Read XML File line by line
    f_in := UTL_FILE.FOPEN ('e:\data', xmlFileName, 'r');
    loop
        begin
        utl_file.get_line(f_in,s_in);
        string:= string || s_in;
        EXCEPTION
            WHEN NO_DATA_FOUND THEN
        EXIT;
        end;
    end loop;
    -- dump it into XMLType
    x := XMLType(string);
    utl_file.fclose(f_in);
    --Clear this string for later use
    string := ' '; 

The variable string (I know it is not the best name for it, but I pieced it from a few samples of code from the Web) is declared as VARCHAR2(32000) and it works OK for most of the (small) xml files I get.

But if the xml file I need to process exceeds 32000 characters, I get the error: "ORA-06502 character string buffer too small"(I believe/guess the error refers to string variable)

Any idea of how to fix it?

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.

RE: ORA-06502 character string buffer too small

2

Use CLOB instead of VARCHAR2(32000).
censored

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

RE: ORA-06502 character string buffer too small

(OP)
I did see this solution in the search I did, I just was not sure if it would work in my case. But works like a charm smile

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close