How do I generate n
occurrences of a character x
separated by a separator like |
? I need to insert this string as an attribute in a relation.
For example, for n=3
and x='a'
, it should be a|a|a
.
Using repeat(a,3)
I get aaa
but how can I add a separator in between?
Well you could just repeat a|
– n
times then clear the excessive |
character:
rtrim(repeat('a|', 3), '|')