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!

Identify the line and replace strings in CLOB

FirstName_LastNameJan 16 2016 — edited Jan 18 2016

Hi,

I have this situation where in I am trying to replace a particular piece of line in CLOB variable.

Example -

This is the input (CLOB variable)

...

...

...

where 1 in (

  decode(O."some_value_1",N."some_value_1",0,1), decode(O."some_value_2",N."some_value_2",0,1),

  decode(O."some_value_3"),N."some_value_3",0,1),

  decode(O."some_value_4",N."some_value_5",0,1),

...

...

...

)

This should be the result (CLOB variable)

...

...

...

where 1 in (

  decode(O."some_value_1",N."some_value_1",0,1), decode(O."some_value_2",N."some_value_2",0,1),

  decode(function_f1(O."some_value_3")),function_f1(N."some_value_3"),0,1),

  decode(O."some_value_4",N."some_value_5",0,1),

...

...

...

)

I tried using REGEXP_INST, REGEXP_SUBSTR, REGEXP_REPLACE - but unable to achieve the objective. The logic I am trying is -

1. Identify if the line exists in my CLOB using REGEXP_LIKE

2. traverse to that piece of line using REGEXP_SUBSTR and extract that entire line that I need to add a function_f1

3. and I get stuck - how do I traverse ahead - this being a CLOB I find myself stuck - had it been a varchar; I could have used combination of INSTR, SUBSTR and REPLACE.

4. DBMS_LOB does not provide in its substr function to match any character and that makes it hard for my objective as I need to traverse to a particular line using a Regular expression

Am I missing some oracle functionality that helps me achieve my goal ?

Any help would be appreciated.

Thanks!

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 15 2016
Added on Jan 16 2016
6 comments
2,222 views