Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Add comma to string every nth char

Alexandra RobinOct 22 2014 — edited Oct 24 2014

I blew it.  I removed all the commas from a field that contains a comma delimited list.  Luckily it's a consistent condition to put the commas back, but I can not find anywhere on the web specific to what I need and I'm just a little STRESSED!

I need to add the comma after every fifth char and each group of 5 starts with a 4.  It is a char field, not a number field for other reasons.  So a string like this

410124101541018 needs to be this 41012,41015.41018.

I am going to have to do this for other length groups as well, but the way I've validated that this particular bunch of strings are divisible by five with a remainder of zero is this: where MOD(MY_STRING, 5) = 0

I've been fooling around with INSTR, SUBSTR, REGEXA_SUBSTR, and REPLACE

Your help is greatly appreciated.

I've got to get this done pronto.

THANK YOU THANK YOU

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 21 2014
Added on Oct 22 2014
6 comments
5,462 views