Purpose
This function deletes all characters in char2 from the right end of char1 until a character not in char2 is found, and returns the result.
Syntax
RTRIM(char1 [,char2])
Parameters
Parameter |
Description |
|---|---|
| char1 | The string. The string can be of the CHAR, VARCHAR2, NCHAR, NVARCHAR2, or CLOB data type. |
| char2 | The set of characters to be deleted. This parameter is optional. The default value is a single space. The string can be of the CHAR, VARCHAR2, NCHAR, NVARCHAR2, or CLOB data type. |
Return type
If
char1is of theCHARorVARCHAR2data type, this function returns a value of theVARCHAR2data type.If
char1is of theNCHARorNVARCHAR2data type, this function returns a value of theNVARCHAR2data type.If
char1is of theLOBdata type, this function returns a value of theLOBdata type.
Examples
Delete the string to the right of OceanBase in the string OceanBaseX**XX*X.
obclient> SELECT RTRIM('OceanBaseX**XX*X','*X') "RTRIM" FROM DUAL;
+-----------+
| RTRIM |
+-----------+
| OceanBase |
+-----------+
1 row in set
