0

I am trying to have in MySQL the same effect as of Oracle's Rtrim.

oracle> RTRIM('Tech6372', '0123456789')
Result: 'Tech'

As you can see Oracle regards the second parameter as a list of characters to be removed, not as a substring to be removed.

This is different from the following in MySQL:

mysql> SELECT TRIM(TRAILING 'xyz' FROM 'barxxyz');
Result: 'barx'

Is there a neat way to get MySQL to do the same thing as Oracle does here?

rapt
  • 11,810
  • 35
  • 103
  • 145
  • Are you able to add User Defined Functions (UDF) such as https://github.com/hholzgra/mysql-udf-regexp however it requires the creation of a UDF. If so then regExp_Replace seems like it may serve your needs the best. additional support: http://stackoverflow.com/questions/986826/how-to-do-a-regular-expression-replace-in-mysql – xQbert Oct 27 '14 at 17:24
  • How do I add a UDF to the Database? – rapt Oct 27 '14 at 18:08
  • http://dev.mysql.com/doc/refman/5.0/en/adding-functions.html for instructions from mySQL – xQbert Oct 28 '14 at 01:13

0 Answers0