Reputation: 14549
I like to write an UPDATE
statement which should change all strings in a column to have the same value like before, but with a seperator string between each character.
Seperator: \s*
Before UPDATE: abcd
After UPDATE: a\s*b\s*c\s*d
What I am missing is some string function to split a string between each character. The string concat with seperator may work with concat_ws() afterwards.
Something like:
UPDATE tab SET col1 = concat_ws('\s*', magic_split(col1));
Upvotes: 1
Views: 839
Reputation: 16915
Try:
UPDATE tab SET col1 = regexp_replace(col1, '(.)', '\1\s*');
Upvotes: 2