Truncating String in sql query
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Truncating String in sql query

  1. #1
    Join Date
    Sep 2007
    Posts
    5

    Truncating String in sql query

    Hi,

    I'm having one location table where the values of location are returned as KC_KansasCity,CHAR_Charlotte,PEW_Pewauke etc,I want to truncate the characters before underscore and also underscore while inserting the data into table.

    i.e for Eg:I've to ignore KC_ and insert only KansaCity into the table.

    Can anybody advise me on how to do this..

    Thanks,
    Anil

  2. #2
    Join Date
    Sep 2007
    Posts
    36
    Use something like this:

    select
    substr('CHAR_Charlotte', instr('CHAR_Charlotte', '_', 1)+1)
    from dual;

    I'm assuming a single underscore in the names.
    J

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