Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Simple replace solution

ronald_2017Sep 20 2024

Hello All,

I use Oracle 19c, is there a way to replace the number of the following string +3 for number which bigger than 25?

As far as I know, REGEXP_REPLACE can be used. However, it might be CPU intensive.

I guess it cannot be done with REPLACE? Something like using the REPLACE function as LIKE operator.

v_str := replace(v_str, 'ref="%'||i||':%'||i||'"', 'ref="%'||(i+3)||':%'||(i+3)||'"')
<mergeCells count="9">
  <mergeCell ref="C85:E85"/>
  <mergeCell ref="C88:E88"/>
  <mergeCell ref="C89:E89"/>
  <mergeCell ref="C90:E90"/>
  <mergeCell ref="C9:E9"/>
  <mergeCell ref="B2:E2"/>
  <mergeCell ref="C4:E4"/>
  <mergeCell ref="C5:D5"/>
  <mergeCell ref="C6:D6"/>
</mergeCells>

I want to update it as below.

<mergeCells count="9">
  <mergeCell ref="C88:E88"/>
  <mergeCell ref="C91:E91"/>
  <mergeCell ref="C92:E92"/>
  <mergeCell ref="C93:E93"/>
  <mergeCell ref="C9:E9"/>
  <mergeCell ref="B2:E2"/>
  <mergeCell ref="C4:E4"/>
  <mergeCell ref="C5:D5"/>
  <mergeCell ref="C6:D6"/>
</mergeCells>

Thanks in advance.

This post has been answered by Solomon Yakobson on Sep 20 2024
Jump to Answer
Comments
Post Details
Added on Sep 20 2024
5 comments
122 views