DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: how find character in string

  1. #1
    Join Date
    Jul 2002
    Posts
    228

    how find character in string

    Hi,
    I've table TAB_TEST:

    ID............DESC_ID
    1.............MY TABLE->YOUR TABLE
    2.............DOG->X
    6.............MY CATS->YOUR CATS
    9.............WINDOWS->Y
    7.............MY JOB->YOUR JOB

    I'd like to write one query with DESC_ID after character "->"

    In my case:

    ID............DESC_ID
    1.............YOUR TABLE
    2.............X
    6.............YOUR CATS
    9.............Y
    7.............YOUR JOB

    How can I find the character "->" in DESC_ID and write from that character in then?


    Thanks in advance!

  2. #2
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    raf, you've been hanging out here since July 2002.

    Haven't you learned anything in that time?
    "The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman

  3. #3
    Join Date
    Jul 2002
    Posts
    228
    Quote Originally Posted by DaPi
    raf, you've been hanging out here since July 2002.

    Haven't you learned anything in that time?
    Thanks for your help!|

  4. #4
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    Quote Originally Posted by raf
    Thanks for your help!|
    He didn't really help you.

    You need to use instr and substr to get the parts of the string that you want. instr will tell you where in a particular string another string exists, and the substr will grab only the part of the string that you want. You might also look at translate.

    DaPi is right, this is pretty basic stuff.

  5. #5
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    I was rather hoping that raf might have learned at least where the manuals are by now . . . . .
    "The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman

  6. #6
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    Quote Originally Posted by DaPi
    raf, you've been hanging out here since July 2002.

    Haven't you learned anything in that time?
    Unfortunately there are quite a few like raf in this forum (or even from 2000, 2001!)

  7. #7
    Join Date
    Jul 2002
    Posts
    228
    Quote Originally Posted by gandolf989
    He didn't really help you.

    You need to use instr and substr to get the parts of the string that you want. instr will tell you where in a particular string another string exists, and the substr will grab only the part of the string that you want. You might also look at translate.

    DaPi is right, this is pretty basic stuff.

    select id, substr(desc_id,instr(desc_id,'->')+2)
    from TAB_TEST;


    THANKS TO ALL!

  8. #8
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    Quote Originally Posted by raf
    select id, substr(desc_id,instr(desc_id,'->')+2)
    from TAB_TEST;


    THANKS TO ALL!
    Your welcome.

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