Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2008
    Posts
    2

    Question Unanswered: How to get a part of the string ?

    How can i get

    1 out of '1 - Jack' or
    26 out of '26 - Dave' or
    436 out of '436 - Michael' ???

    There is a blank space on either side of Hiphen (_-_).

    I am using Oracle SQL+ V9i

  2. #2
    Join Date
    Dec 2007
    Posts
    253
    Hi, you need the SUBSTR function
    You can find the syntax and usage notes here

  3. #3
    Join Date
    Jan 2008
    Posts
    2
    can u give me the syntax for my case.. i am new at SQL !

  4. #4
    Join Date
    Dec 2007
    Posts
    253
    If you are new at SQL surely you are better looking at the link that I provided you and learning how to do, what is an extremely simple task, for yourself. I will not spoon feed you, I will happily help you if you run into problems however, so long as you show me that you have put in some effort. Is this school work?

  5. #5
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    One hint, use substr and instr. Now check out the link.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  6. #6
    Join Date
    Aug 2004
    Location
    France
    Posts
    754
    Quote Originally Posted by beilstwh
    One hint, use substr and instr. Now check out the link.
    Plus TO_NUMBER if you want your result as a number instead of a string .

    rbaraer
    ORA-000TK : No bind variable detected... Shared Pool Alert code 5 - Nuclear query ready .

Posting Permissions

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