Home > Mobile >  Need to remove only character which are at the end
Need to remove only character which are at the end

Time:11-08

Need to remove only characters at the end.

  1. 2014JP34343DD
  2. 2013GH43422

Output:

  1. 2014JP34343
  2. 2013GH43422

Tried regexp fuctions and even simple substr and instr function but not able to remove it.

CodePudding user response:

regexp_replace seems to be a simple option:

SQL> with test (col) as
  2    (select '2014JP34343DD' from dual union all
  3     select '2013GH43422'   from dual
  4    )
  5  select col,
  6         regexp_replace(col, '[[:alpha:]] $') result
  7  from test;

COL           RESULT
------------- -------------
2014JP34343DD 2014JP34343
2013GH43422   2013GH43422

SQL>
  • Related