Results 1 to 3 of 3

Thread: substr

  1. #1
    Join Date
    Aug 2008
    Posts
    464

    Unanswered: substr

    Hi

    I have a string:

    'Ghala-HLR1V9/CPU Measurement:MN=231,MT=DSU'

    How can I pick out 'Ghala-HLR1V9' and 'DSU' in the same SQL? so that I get:

    Ghala-HLR1-DSU

    I tried:

    select SUBSTR('Ghala-HLR1V9/CPU Measurement:MN=231,MT=DSU',1,INSTR('Ghala-HLR1V9/CPU Measurement:MN=231,MT=DSU','V')-1) from dual

    but this just gave:
    Ghala-HLR1

    Thanks
    Last edited by shajju; 09-15-09 at 04:50. Reason: Correction

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    You have to use another SUBSTR, but this time counting 3 characters from the end of the string:
    Code:
    SELECT SUBSTR(your_string, -3) FROM dual

  3. #3
    Join Date
    Aug 2008
    Posts
    464
    Thanks ........

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •