pl-sql clob数据问题

时间:2017-10-23 14:10:15

标签: oracle plsql

嗨,低于错误

06502. 00000 -  "PL/SQL: numeric or value error%s"
*Cause:    An arithmetic, numeric, string, conversion, or constraint error
           occurred. For example, this error occurs if an attempt is made to
           assign the value NULL to a variable declared NOT NULL, or if an
           attempt is made to assign an integer larger than 99 to a variable
           declared NUMBER(2).
*Action:   Change the data, how it is manipulated, or how it is declared so
           that values do not violate constraints.

当我运行以下pl-sql代码

 DECLARE    
    type c_list is varray (6000) of varchar2(50);    
    name_list c_list := c_list();    
    counter integer :=0;    
    n number;    
    ADDHDR VARCHAR2(5000);    
    new_envelope clob:=NULL;    
BEGIN    
    DBMS_OUTPUT.ENABLE(1000000);    
    FOR n in 1..1000 LOOP    
        counter := counter + 1;    
        name_list.extend;    
        name_list(counter)  := 'ABCNDFHDDJJ';    
        dbms_output.put_line('Customer('||counter ||'):'||name_list(counter));    
    END LOOP;

    for i in name_list.first .. name_list.last loop    
        ADDHDR := CONCAT(ADDHDR,'<ADDITIONAL_START>');    
        ADDHDR := CONCAT(ADDHDR, CONCAT('<START>', CONCAT('ADDR-KYC-ABCD-PRD-LDB-SMS-OR-START', '</START>')));    
        ADDHDR := CONCAT(ADDHDR, CONCAT('<ENDED>', CONCAT(name_list(i), '</ENDED>')));    
        ADDHDR := CONCAT(ADDHDR, '</ADDITIONAL_START>');    
        dbms_output.put_line('PROCESSING');    

        new_envelope := new_envelope || ADDHDR;   
        ADDHDR:=''    
    end loop;    
    dbms_output.put_line(new_envelope);    
END;    
/    

请帮我将字符串(值大于4000个字符)连接到clob数据

提前致谢

1 个答案:

答案 0 :(得分:1)

问题是这一行dbms_output.put_line(new_envelope);

您无法输出如此大的字符串。我认为这仅用于调试,即实际上不需要。

如果你真的需要dbms_output.put_line,那就一行一行。