All Products
Search
Document Center

RTRIM

Last Updated: Jun 18, 2021

The RTRIM function deletes a string that appears on the right side. This function is useful for formatting the output of a query.

Syntax

RTRIM(c1 [,c2])

RTRIM deletes c2 from the right end of all the characters that appear in c1. If you do not specify c2, the default value is a single space.

Parameters

Parameter

Description

c1

The string.

c2

The string to be deleted. The default value is a space.

The data types of c1 and c2 can be CHAR, VARCHAR2, NCHAR, NVARCHAR2, and CLOB.

Return type

If the data type of c1 is CHAR or VARCHAR2 , the function returns the VARCHAR2 data type.

If the data type of c1 is NCHAR or NVARCHAR2, the function returns the NVARCHAR2 data type.

If the data type of c1 is CLOB, the data type of the returned string is CLOB.

Examples

Execute the following statement:

SELECT RTRIM('gao qian jingXXXX','X') text FROM DUAL;

The following query result is returned:

+------------------+
|   TEXT           |
+------------------+
|   gao qian jing  |
+------------------+