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

Thread: SQL question for -- substr

  1. #1
    Join Date
    Aug 2002
    Posts
    18

    SQL question for -- substr

    Hi,

    I want to get the last 3 characters of a string. How can I get it?

    Thanks!

  2. #2
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    substr(length('ABCDEFG')-2,3), i would think.
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  3. #3
    Join Date
    Aug 2002
    Posts
    18
    Thanks, i got it.

  4. #4
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Even more simple and straightforward:

    substr('ABCDEFG',-3)
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  5. #5
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    Originally posted by jmodic
    Even more simple and straightforward:

    substr('ABCDEFG',-3)
    Oooooooooo!

    You see if I read the documentation more often, I'd have known that.
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  6. #6
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    Hi slimdave,
    You've got to give it to Jurij, he's good. But don't let him know I said that, he might get big headed

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