发现dbms._output.put_line 不能输出大于255的字符串
后来发现如果改用OUT参数(VARCHAR类型)也不行,难道ORacle不能返回>255的字符串吗?(注意我指返回参数,不是IN参数)

解决方案 »

  1.   

    我原来还用过dbms_output.enable(20000); 但不行(后来又行了??)
      

  2.   

    dbms._output.put_line 不能输出大于255的字符串 ---->正是這樣。
    可以。
      

  3.   

    create or replace procedure test(s out string) is
    begin
      for i in 1..300 loop
         s:=s||to_char(i);
      end loop;
    end test;SQL> declare
      2    s string(2000);
      3  begin
      4    test(s);
      5  end;
      6  /PL/SQL procedure successfully completed
      

  4.   

    declare
    str varchar2(1000):='...';
    begin
    for i in 1..ceil(length(str)/255) loop
    if i=1 then
    dbms_output.put_line(substr(str,1,i*255));
    else
    dbms_output.put_line(substr(str,(i-1)*255,i*255));
    end if;
    end loop;
    end;
    /