A recursive WITH can do this. Here's an example where I want to replace names in a string with the equivalent twitter handles, where the number of replacements is unknown.
SQL> select * from messages;
TXT
----------------------------------------------------------
I caught up with Connor and Maria Colgan today. They have taken over AskTOM for Oracle Developers
SQL> select * from twitter_handles;
ID TERM HANDLE
---- ------------------------------ ---------------
1 Connor McDonald @connor_mc_d
2 Connor @connor_mc_d
3 Maria Colgan @sqlmaria
4 Oracle Developers @otndev
5 Oracle @oracle
6 AskTOM @oracleasktom
SQL> with
2 tweetised(ind,tweet_txt) as
3 (
4 select 1 ind, txt tweet_txt
5 from messages
6 union all
7 select ind+1, replace(tweet_txt,term,handle)
8 from tweetised, twitter_handles
9 where ind = id
10 )
11 select * from tweetised;
IND TWEET_TXT
--------- -----------------------------------------------------------------------------------------
1 I caught up with Connor and Maria Colgan today. They have taken over AskTOM for...
2 I caught up with Connor and Maria Colgan today. They have taken over AskTOM for...
3 I caught up with @connor_mc_d and Maria Colgan today. They have taken over AskTOM for...
4 I caught up with @connor_mc_d and @sqlmaria today. They have taken over AskTOM for ...
5 I caught up with @connor_mc_d and @sqlmaria today. They have taken over AskTOM for @otndev
6 I caught up with @connor_mc_d and @sqlmaria today. They have taken over AskTOM for @otndev
7 I caught up with @connor_mc_d and @sqlmaria today. They have taken over @oracleasktom ...
SQL> with
2 tweetised(ind,tweet_txt) as
3 (
4 select 1 ind, txt tweet_txt
5 from messages
6 union all
7 select ind+1, replace(tweet_txt,term,handle)
8 from tweetised, twitter_handles
9 where ind = id
10 )
11 select * from tweetised
12 order by ind desc
13 fetch first 1 row only;
IND TWEET_TXT
---------- ------------------------------------------------------
7 I caught up with @connor_mc_d and @sqlmaria today. They...