Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase dbms_output buffer?

Tags:

I tried to debug my dynamic query via dbms_output but seems like the query string is too long for dbms_output buffer.

I got :

ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at "SYS.DBMS_OUTPUT", line 148 ORA-06512: at line 1  

Any idea how to increase the buffer size ?

like image 275
hsuk Avatar asked May 10 '13 06:05

hsuk


People also ask

What is buffer size in DBMS_OUTPUT?

The default buffer size is 20000 bytes. The minimum size is 2000 bytes and the maximum is unlimited.

What is the limit on DBMS_OUTPUT Put_line?

You can only print a maximum of 255 characters per dbms_output. put_line command.

Does DBMS_OUTPUT Put_line affect performance?

Every extra line of code decreases the performance of code. After all, it is an extra instruction to be executed, which at least consumes some CPU. So yes, dbms_output. put_line decreases the performance.


1 Answers

You can Enable DBMS_OUTPUT and set the buffer size. The buffer size can be between 1 and 1,000,000.

dbms_output.enable(buffer_size IN INTEGER DEFAULT 20000); exec dbms_output.enable(1000000); 

Check this

EDIT

As per the comment posted by Frank and Mat, you can also enable it with Null

exec dbms_output.enable(NULL); 

buffer_size : Upper limit, in bytes, the amount of buffered information. Setting buffer_size to NULL specifies that there should be no limit. The maximum size is 1,000,000, and the minimum is 2,000 when the user specifies buffer_size (NOT NULL).

like image 107
Gopesh Sharma Avatar answered Oct 24 '22 02:10

Gopesh Sharma