By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 883 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

format string from given pattern

P: 1
hi everyone,

i am trying to write postgresql query for below scenario:

inputs :
1. alphanumeric string e.g. abcd1234efgh
2. pattern e.g. [1][2][3][2][1][3]
3. delimiter e.g - (hyphen)

output : a-bc-d12-34-e-fgh

i require query. function wont work for me.

any help is welcome.

thanks
Mar 16 '13 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,349
If you are saying that the pattern and delimiter won't change. You can use a series of substrings to get the output. If, however, it is variable, you will have to use a function, I don't see any way around that.
Mar 18 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.