Split a column/field
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Split a column/field

  1. #1
    Join Date
    Sep 2011
    Posts
    2

    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

  2. #2
    Join Date
    Sep 2011
    Posts
    2
    sorry I should have mentioned using sqlplus

  3. #3
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,554
    Quote Originally Posted by Adsters View Post
    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
  •  



Click Here to Expand Forum to Full Width