Purpose
RTRIM() removes, from the right end of char1, all characters contained in char2 until a character not in char2 is reached on the right end of char1 and returns the result.
Syntax
RTRIM(char1 [,char2])
Parameters
| Parameter | Description |
|---|---|
| char1 | The source string. It can be of the CHAR, VARCHAR2, NCHAR, NVARCHAR2, or CLOB data type. |
| char2 | The set of characters to be removed from the string. This parameter is optional. The default value is a blank space. It can be of the CHAR, VARCHAR2, NCHAR, NVARCHAR2, or CLOB data type. |
Return type
If
char1is of theCHARorVARCHAR2data type, the return type isVARCHAR2.If
char1is of theNCHARorNVARCHAR2data type, the return type isNVARCHAR2.If
char1is of theLOBdata type, the return type isLOB.
Examples
The following example removes from the string OceanBaseX**XX*X all characters on the right side of OceanBase.
obclient> SELECT RTRIM('OceanBaseX**XX*X','*X') "RTRIM" FROM DUAL;
+-----------+
| RTRIM |
+-----------+
| OceanBase |
+-----------+
1 row in set