as part of a PL/SQL script, we are setting a Varchar variable called 'V_COMMENT' as such:
V_COMMENT := INCOMING_COMMENT || '[' || V_COMMENT || ']';
because this statement is run potentially multiple times for each record, we will eventually end up with a comment like:
process 578 [process 456[process 123]]
There is an issue, when re running this script, sometimes a duplicate tag can be added as such:
process 123 [process 123 [process 000]]
or
process 456 [process 123 [process 123]]
Where a comment is repeated, and nested.
Is there a way to use Regexp_Replace() to remove duplicate tags, nested or otherwise?
OR ALTERNATIVELY
Is there a way to catch occurrences of these errant comments with regexp_like
You can use solution below to remove duplicates comments. in fact, I use dynamic sql within pl/sql to solve the problem.
demo : pl/sql
Here is the sql part of my solution :
demo : sql