RTRIM

2023-10-24 09:23:03  Updated

Purpose

You can call this function to remove, 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 return the result.

Syntax

RTRIM(char1 [,char2])

Parameters

Parameter Description
char1 The string from which the characters are to be removed. 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 char1 is of the CHAR or VARCHAR2 data type, the return type is VARCHAR2.

  • If char1 is of the NCHAR or NVARCHAR2 data type, the return type is NVARCHAR2.

  • If char1 is of the LOB data type, the return type is LOB.

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

Contact Us