Reputation: 303
I have a sentence like this :
A quick brown fox jumped over the lazy dog
I want to put a comma after every 3 word :
A quick brown , fox jumped over, the lazy dog,
Is it possible using query in Oracle ?
Upvotes: 0
Views: 182
Reputation: 1269563
regexp_replace()
would do what you want. Here is one rather simplistic method:
select regexp_replace(s, '([^ ]+[ ]+[^ ]+[ ]+[^ ]+)', '\1,')
from (select 'A quick brown fox jumped over the lazy dog' s from dual) x
Upvotes: 3