Oracle multiple REPLACE options in REGEXP_REPLACE

677 views Asked by At

I have a requirement to replace a part of the string with a new value. Eg: An ITEM ([loc]-[number]) where both LOC and NUMBER are numeric fields.

I have a list of items and I need to replace ITEM's starting with LOC 111, 222, 333 to 444, 555, 666 respectively.

I tried REGEXP_REPLACE function but it allows multiple search patterns and a single replace pattern. Is there an option to allow multiple replace patterns as well?

Eg:

select regexp_replace('111-123456','111|222|333','444|555|666',1,1) from dual

Is the above possible?

0

There are 0 answers