Is it possible to replace multiple occurrences of the pattern with a substring using REGEXP_REPLACE function in Oracle. I tried multiple permutation & combination of the regex expression, but somehow it didn’t work out correctly. Superficially it looks doable but not very sure.. any ideas or pointer to try out. Sample input/output below
INPUT_STRING = SELECT @DATA:T.ID:ID@, @DATA:T.NAME:NAME@, @DATA:T.ADDRESS:ADDRESS@, @DATA:T.CREATED_DATE:CREATED_DATE@ FROM TABLE_NAME T
OUTPUT_STRING = SELECT T.ID ID, T.NAME NAME, T.ADDRESS ADDRESS FROM TABLE_NAME T
In essence, we need to achieve below in the fixed pattern
@DATA:xx.yy:zz@, where xx is table, yy is column name, zz column alias
- Remove @DATA: from the beginning of string
- Remove @ at the end of string
- Replace : with space