Results 1 to 4 of 4

Thread: Substr/instr

  1. #1
    Join Date
    Aug 2008
    Posts
    464

    Unanswered: Substr/instr

    Hi

    Need some help on using SUBSTR/INSTR.

    I need to pick out the first 6 characters after the occurrence of the first space character in the following string: i.e., FGH111

    Code:
    ABCDE FGH111/QWE9999UCQWE:LABEL=QWERTY, CELLID-12345
    If anyone could spare a few minutes?


    Regards
    Shajju
    Last edited by shajju; 02-05-13 at 08:46.

  2. #2
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    substr(string,instr(string,' ')+1,6)
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  3. #3
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Regular expressions option:
    Code:
    SQL> with test as
      2    (select 'ABCDE FGH111/QWE9999UCQWE:LABEL=QWERTY, CELLID-12345' col from dual)
      3  select regexp_substr(col, '\w+', 1, 2) result
      4  from test;
    
    RESULT
    ------
    FGH111
    
    SQL>

  4. #4
    Join Date
    Aug 2008
    Posts
    464
    Thanks guys. It works.

Posting Permissions

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