我的插入触发器无法插入超过 450 个值

问题描述 投票:0回答:1
Declare 
     sqlstmt1 clob;
     TYPE uwa_assoc_array IS TABLE OF CLOB INDEX BY PLS INTEGER;
      uwa_data uwa_assoc_array;
      prev number;
BEGIN 
   sqlstmt1:= ‘create or replace ins_wafer_summary_extend_trig instead of insert on insp_wafer_summary_extend referencing new as new old as old for each row’ || chr(10);
     sqlstmt1 := sqlstmt1 || ‘DECLARE uwadata clob; BEGIN’ || CHR(10);
      for confrecord IN (SELECT column_key,column_name from udbc_defect_extend_conf where event_type = 2) LOOP
           uwa_data(uwa_data.COUNT+1) := CHR(10) || ‘if :new.’ || trim(confrecord.column_name) || ‘!= :old.’ || trim(confrecord.column_name) || ‘then’ || CHR(10) || ‘ dbms_lob.append(uwadata, ‘’’|| trim(confrecord.column_key) || ‘:’ || ‘’’ || : new.’ || trim(confrecord.column_name) || ‘);’ || CHR(10) || ‘end if;’;
       End loop;

       For i in 1..uwa_data.COUNT LOOP
         dbms_lob.append(sqlstmt1,uwa_data(i);
       End loop;

       sqlstmt1 := sqlstmt1 || CHR(10) || ‘INSERT INTO insp_wafer_summary_extend_m(inspection_time,wafer_key,UWA_ATTR) values (:new.inspection_time,:new.wafer_key,uwadata);’ || chr(10) || ‘END;’;
       Execute immediate sqlstmt1;
End;

Insp_wafer_summary_extend 是一个视图,它由近 700 列组成,我尝试向其中插入值。直到 450 值一切都工作正常,但之后我就开始了

ORA-01499: 字符串连接结果太长错误

我希望为所有 700 列插入值。

database oracle oracle11g oracle-sqldeveloper clob
1个回答
0
投票

虽然 SQL 中的 CLOB 的大小实际上是无限的,但 PL/SQL 无法处理大于 32K 的字符串。如果您的列名称连接成一个比该长度长的字符串,您的脚本将会失败。

请参阅此处了解详细信息:https://blogs.oracle.com/connect/post/working-with-strings

© www.soinside.com 2019 - 2024. All rights reserved.