Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2011
    Posts
    85

    Unanswered: Extract only the Character from a Varchar 2 column

    Helloo All

    I want to know iz there is a way to extract a Letter from a Varchar2 column

    Here is a example

    20111020/A/ - Extract A

    20111520/B/ - Extract B

    Plz provide ideas...

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Code:
    select regexp_replace('20111020/A/','[^A-Za-z]', '')
    from dual

  3. #3
    Join Date
    Sep 2011
    Posts
    85
    Thanx for the help...

    It works like a charm...

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Another option:
    Code:
    SQL> with test as
      2    (select '20111020/A/' col from dual union
      3     select '20111520/B/' from dual
      4    )
      5  select col,
      6    regexp_substr(col, '[[:alpha:]]+') res
      7  from test;
    
    COL         RES
    ----------- --------------------------------------------
    20111020/A/ A
    20111520/B/ B
    
    SQL>

Posting Permissions

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