The Oracle and PL/SQL RTRIM function removes all specified characters from the right-hand side of a string.
The general format is:
RTRIM(char1 [,charlist])
Example 1:
SELECT RTRIM('JOHN WILLIAMS ') FROM DUAL;
returns:
JOHN WILLIAMS
Example 2:
SELECT RTRIM('JOHN WILLIAMS-------','-') FROM DUAL;
returns:
JOHN WILLIAMS
Example 3:
SELECT RTRIM('JOHN WILLIAMS-1 0-3-',' -1234567890') FROM DUAL;
returns:
JOHN WILLIAMS