The Oracle/PLSQL function rtrim removes all specified characters from the right of a string. It removes every occurrence of specified characters that are leading the string.
Syntax:
RTRIM(string, trim_string)
string is the string from which characters have to be trimmed. trim_string is optional. It is the set of characters that will be removed from the right of the string. The default for this is space.
Example code:
SELECT RTRIM(' author ') trimmed_name FROM dual
This returns ‘ author‘
SELECT RTRIM('ABCABCauthorABC', 'ABC') trimmed_name FROM dual
trimmed_name
————-
ABCABCauthor
SELECT RTRIM('124523124author3438', '0123456789') trimmed_name FROM dual
trimmed_name
————-
124523124author
Note: rtrim removes individual occurrences of the number that are trailing in the string