-
Split a column/field
OK,
I have a field where the values are like so
#TASK CPH-555#
#TASK CPH-546# #TASK CPH-576#
#TASK CPH-766# some blah blah
#TASK ADB-756# some blah blah #TASK CPH-57#
some blah blah #TASK CPH-987#
#TASK CPH-756# #TASK ABD-764# #TASK CPH-888"
Now, I need to split this field and extract only the "CPH-nnn" or the ADB-nn" parts of the text string.
Any ideas,
Thanks in advance
-
sorry I should have mentioned using sqlplus
-
Originally Posted by Adsters
OK,
I have a field where the values are like so
#TASK CPH-555#
#TASK CPH-546# #TASK CPH-576#
#TASK CPH-766# some blah blah
#TASK ADB-756# some blah blah #TASK CPH-57#
some blah blah #TASK CPH-987#
#TASK CPH-756# #TASK ABD-764# #TASK CPH-888"
Now, I need to split this field and extract only the "CPH-nnn" or the ADB-nn" parts of the text string.
Any ideas,
Thanks in advance
This may point you in the right direction...
Code:
select SUBSTR('#TASK CPH-555# blah blah blah',
(INSTR('#TASK CPH-555# blah blah blah','CPH')),
7) "EXTRACTED VALUE"
from DUAL
;
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|