Link to home
Start Free TrialLog in
Avatar of sakthikumar
sakthikumar

asked on

ora-06502: Plsql numeric or value error: Character string buffer too small

I ran a plsql block like below

declare
rs clob;
begin
rs:=STG_STG(84,4);
commit;
dbms_output.put_line(rs);
end;

when I am trying to output rs I am getting "Plsql numeric or value error: Character string buffer too small".

How to resolve this?
Avatar of Sean Stuber
Sean Stuber

what is the full error text?

It probably points to stg_stg  function with line numbers.


what does stg_stg do?
You are probably using a default size for the serveroutput parameter (needed for use of dbms_output) and/or the long parameter. Try the following:
set serverout on size 1000000
set long 32000
and re-run to see what happens.
Avatar of sakthikumar

ASKER

when I comment out dbms_output.put_line(rs); -- no error
when I comment out dbms_output.put_line(rs); -- no error
Then as sdtuber suggested, is the error is likely coming from: rs:=STG_STG(84,4);

What is stg_stg and what does it do?
I dont think there is any error in stg_stg.

Because only when i am using DBMS_OUTPUT, I am getting this error.

And the full error message is
ORA-06502  : PL/SQL  numeric or value error :character string buffer too small
ORA-06512 : at "SYS.DBMS_OUTPUT", line 151
ORA-06512 : at line 2

Atleast i want to know the reason for this error. If this cant be solved out.
Tried
set serverout on size 1000000
set long 32000

but still getting the error.
Hi all,

This error I am getting only in PLSQL developer.

When I run from sql plus, am not getting any error. I dint even change any output settings.

Do I  need to make any specific settings in plsql developer to make this run?

Thanks,
Sakthi.
>>Tried
set serverout on size 1000000
set long 32000<<
Was this done from sql plus or in sql developer?

in 10g and above dbms_output.put_line can only display a line 32767 characters long  

in 9i and lower the limit is 255 characters


these limits are regardless of the serveroutput limit


are you trying to print a really long clob string?
What does the function stg_stg look like?
>>This error I am getting only in PLSQL developer.

There is likely a limitation build into PL/SQL Developer.  I am unable to locate their documentation to prove this but there is a support email posted.  They can confirm this.

http://www.allroundautomations.com/plsqldev.html


the dbms_output limits mentioned above ( http:#37088669 ) will apply regardless of the tool


declare
    v_toobig  clob := rpad('x',32767) || rpad('x',32767);
begin
    dbms_output.put_line(v_toobig);
end;
>>will apply regardless of the tool

True but the OP mentions it works in sqlplus so I have to assume it is less than the 32K limit.
Do you have more than one oracle client installed?

If so,  is PL/SQL Developer using the same client that your sql*plus is coming from?


Also, are you sure you're running exactly the same code in sql*plus and pl/sql developer?

Are there any other scripts involved?  login.sql, glogin.sql  that are executed in one or the other?
sdstuber,

when no of chars > 32767 is throwing error in all the tools.

But my output is 15311 chars only. I can execute this in sql plus but not in plsql developer.
running the same code in both the tools.
also only one client installed in my machine.
I apologize,  I was making this much too difficult

 using this...

begin
    dbms_output.put_line(rpad('x',15311,'x'));
end;

Open in new window



I was able to replicate your error in pl/sql developer.
It's a known bug and AllroundAutomations  is working on it

as a work around, split your clob into chunks of 4000 bytes or less

ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks sdstuber for all your responses.