I am trying to insert data into table which have values more than 4000 character, to overcome with this i have made column qcnotes datatype clob on zzz_drop_result_718001 but i couldn’t get it done.
`
DECLARE
GRPNM VARCHAR2(100);
CLOBNOTES CLOB;
BEGIN
DELETE ZZZ_DROP_RESULT_718001;
COMMIT;
FOR REC IN (SELECT * FROM zzz_vw_recentdrop)
LOOP
BEGIN
IF REC.NOTELENGTH <= 3999 THEN
INSERT INTO ZZZ_DROP_RESULT_718001 (
loggeddate, category, groupname, payer, datatype, qcnotes, ATTACHMENT, QCCONCERN
) VALUES (
REC.LOGGEDDATE, REC.CATEGORY, REC.GROUPNAME, REC.PAYER, NULL, REC.QCNOTES, REC.ATTATCHMENT, REC.QCCONCERN
);
commit;
ELSIF length(substr(rec.qcnotes,4000,rec.notelength))<=3999 then
Dbms_Output.PUT_LINE(‘Note length too long: ‘ || REC.GROUPNAME);
clobnotes:=substr(rec.qcnotes,4000,rec.notelength);
--CLOBNOTES := EMPTY_CLOB();
--DBMS_LOB.CREATETEMPORARY(CLOBNOTES, TRUE);
--DBMS_LOB.WRITEAPPEND(CLOBNOTES, LENGTH(REC.QCNOTES), REC.QCNOTES);
GRPNM := REC.GROUPNAME;
INSERT INTO ZZZ_DROP_RESULT_718001 (
loggeddate, category, groupname, payer, datatype, qcnotes, ATTACHMENT, QCCONCERN
) VALUES (
REC.LOGGEDDATE, REC.CATEGORY, REC.GROUPNAME, REC.PAYER, NULL, CLOBNOTES, REC.ATTATCHMENT, REC.QCCONCERN
);
COMMIT;
update ZZZ_DROP_RESULT_718001 set qcnotes=qcnotes||clobnotes where groupname=grpnm;
commit;
END IF;
EXCEPTION WHEN OTHERS THEN Dbms_Output.PUT_LINE('Note length too long: ' || REC.GROUPNAME);
end;
END LOOP;
END;`
got error:
Error report - ORA-01489: result of string concatenation is too long ORA-06512: at line 7 ORA-06512: at line 7 01489. 00000 - "result of string concatenation is too long" *Cause: String concatenation result is more than the maximum size. *Action: Make sure that the result is less than the maximum size.
i want to insert data with more than 4000 character, i tried using substr and break and insert but it is not working. I have tried using dbms_lob,xmlagg