Today the Debug program reported the following error:
ORA-22828:Input PatternorReplacement parameters exceed +K Size Limit22828. 00000 - "input pattern or replacement parameters exceed 32K size Limit"*cause:Value provided forThe patternorReplacement StringinchThe form ofVARCHAR2orCLOB forLOB SQL functions exceeded the +K Size Limit.*Action: Usea shorter patternorprocess a long pattern stringinchMultiple Passes.
The following scripts can be reproduced:
DECLARE CB CLOB; RET_CB clob;begin CB: = Rpad (' x ', 32767, ' x ') | | ' X '; RET_CB: = ' <resp> #result #</resp> '; RET_CB: = replace (RET_CB, ' #result # ', CB); end;/
The solution is as follows:
To write a function:
Create or Replace function Replace_with_clob (i_source in Clob , i_search in Varchar2 , i_replace in Clob ) return Clob is L_pos pls_integer;begin l_pos: = InStr (I_source, I_search); If L_pos > 0 Then return substr (I_source, 1, l_pos-1) | | i_replace | | substr (i_source, L_pos+length (i_ Search)); End If; return i_source;end Replace_with_clob;
After rewriting:
DECLARE CB CLOB; RET_CB clob;begin CB: = Rpad (' x ', 32767, ' x ') | | ' X '; RET_CB: = ' <resp> #result #</resp> '; RET_CB: = Replace_with_clob (RET_CB, ' #result # ', CB); Dbms_output.put_line (substr (RET_CB, 1,)); end;/
Successful execution!
-----------------------------------
Dylan presents.
ORA-22828 input style or replacement parameter exceeds 32k size limit