ORA-22828 input style or replacement parameter exceeds 32k size limit

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.