Oracle pl / sql error: put_line cannot be more than 2000 characters

Has anyone else noticed this phenomenon when dbms_output.put_lineit cannot print more than 2000 characters at a time?

Script:

set serveroutput on size 100000;

declare
    big_str varchar2(2009);
begin
    for i in 1..2009 loop
        big_str := big_str||'x';
    end loop;

    dbms_output.put_line(length(big_str));
    dbms_output.put_line(big_str);
end;

/

I copied and pasted the output into an editor (Notepad ++), which told me that there are only 2,000 characters, not 2009, which I think should have been pasted. This also happens with a few of my test scripts - only 2,000 characters are printed.

I have a workaround for printing as follows:

dbms_output.put_line(length(big_str));
dbms_output.put_line(substr(big_str,1,1999));
dbms_output.put_line(substr(big_str,2000));

This adds new lines to the output, making it difficult to read when the text you are working with is pre-formatted.

Has anyone else noticed this? Is this really a mistake or some obscure feature? Is there a better workaround? Is there any other information about this?

Oracle: 10.2.0.3.0, PL/SQL Developer ( Allround Automation).

+3
6

Oracle put_line, IDE.

Oracle: http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_output.htm#ARPLS036

  • - 32767 .
  • - 20000 . - 2000 , - .

SQL * Plus.

, 2000, , IDE ​​, .

+10

, . , , dbms_output.put dbms_output.put_line

+1

TFM, 32767. DBMS_OUTPUT.GET_LINE ; , DBMS_OUTPUT. , PL/SQL Developer.

+1

dbms_output.enable(1000000);

...

-2

, Oracle, script.

Oracle , (1 ) = (1 ) , (x bytes) = (1 ).

VARCHAR2 BYTES, , , VARCHAR2 (2009) , 2009 .

VARCHAR2 Oracle max 4000 , , , , 4000 = 4000 . 2000 , , , .

You can learn more about this at http://download-uk.oracle.com/docs/cd/B28359_01/server.111/b28318/datatype.htm#i1835 . This link is for an Oracle 11.1 database, but I don’t think much has changed when it comes to data types.

I hope you find this information helpful.

-2
source

Try setting the string in SqlPlus.

set linesize 4000

You may also need to set the page size below.

-2
source

Source: https://habr.com/ru/post/1723413/


All Articles