RTRIM
The RTRIM function removes from the right end of Expression1 all of the characters contained in Expression2. TimesTen scans Expression1 backward from its last character and removes all characters that appear in Expression2 until reaching a character not in Expression2 and then returns the result.
                  
SQL syntax
RTRIM (Expression1[,Expression2])
Parameters
RTRIM has the parameters:
                  
| Parameter | Description | 
|---|---|
| 
                               
  | 
                           
                               The   | 
                        
| 
                               
  | 
                           
                               Optional expression used for trimming   | 
                        
Description
- 
                        
If
Expression1is of typeCHARorVARCHAR2, the data type returned isVARCHAR2. IfExpression1is of typeNCHARorNVARCHAR2, the data type returned isNVARCHAR2. IfExpression1is aCLOBorNCLOB, the data type returned is the same as the LOB data type provided. The returned data type length is equal to the data type length ofExpression1. - 
                        
If
Expression1is a data type defined withCHARlength semantics, the returned length is expressed inCHARlength semantics. - 
                        
If either
Expression1orExpression2isNULL, the result isNULL. - 
                        
You can specify
TT_CHAR,TT_VARCHAR,TT_NCHAR, andTT_NVARCHARforExpression1andExpression2. IfExpression1is of typeTT_CHARorTT_VARCHAR, the data type returned isTT_VARCHAR. IfExpression1is of typeTT_NCHARorTT_NVARCHAR, the data type returned isTT_NVARCHAR. - 
                        
If
Expression1is of typeCHARorVARCHAR2andExpression2is of typeNCHARorNVARCHAR2, thenExpression2is demoted toCHARorVARCHAR2beforeRTRIMis invoked. The conversion ofExpression2could be lost. If the trim character ofExpression2is not in the database character set, then the query may produce unexpected results. - 
                        
For
CHAR,VARCHAR2,NCHAR,NVARCHAR2,CLOBandNCLOBtypes:- 
                              
If all the characters in
Expression1are removed by theRTRIMfunction, the result isNULL. 
 - 
                              
 - 
                        
For
TT_CHAR,TT_VARCHAR,TT_NCHARandTT_NVARCHARtypes:- 
                              
If all the characters in
Expression1are removed by theRTRIMfunction, the result is the empty string. 
 - 
                              
 
Examples
The following example trims the trailing spaces from col1 in table rtrimtest.
                  
Command> CREATE TABLE rtrimtest (col1 VARCHAR2 (25));
Command> INSERT INTO rtrimtest VALUES ('abc     ');
1 row inserted.
Command> SELECT * FROM rtrimtest;
< abc      >
1 row found.
Command> SELECT RTRIM (col1) FROM rtrimtest;
< abc >
1 row found.
Call the RTRIM function to remove right-most 'x' and 'y' from string. RTRIM removes individual occurrences of 'x' and 'y', not pattern 'xy'.
                  
Command> SELECT RTRIM ('RTRIM Examplexxxyyyxyxy', 'xy') FROM dual;
< RTRIM Example >
1 row found.
Call RTRIM to remove all characters from Expression1. In the first example, the data type is CHAR, so NULL is returned. In the second example, the data type is TT_CHAR, so the empty string is returned.
                  
Command> CREATE TABLE rtrimtest (col1 CHAR (4), col2 TT_CHAR (4));
Command> INSERT INTO rtrimtest VALUES ('BBBA', 'BBBA');
1 row inserted.
Command> SELECT RTRIM (col1, 'AB') FROM rtrimtest;
< <NULL> >
1 row found.
Command> SELECT RTRIM (col2, 'AB') FROM rtrimtest;
<  >
1 row found.