카테고리:

문자열 및 이진 함수 (일반)

RTRIM

문자열에서 화이트스페이스를 포함한 후행 문자를 제거합니다.

참고 항목:

LTRIM , TRIM

구문

RTRIM(<expr> [, <characters> ])
Copy

인자

expr

트리밍할 문자열 식입니다.

characters

expr 의 오른쪽에서 제거할 하나 이상의 문자입니다.

The default value is ' ' (a single blank space character), i.e. if no characters are specified, only blank spaces are removed.

Usage Notes

  • The characters in characters can be specified in any order.

  • To remove whitespace, the characters must be explicitly included in the argument. For example, ' $.' removes all leading blank spaces, dollar signs, and periods from the input string.

    Note that this does not remove other whitespace characters (tabulation characters, end-of-line characters, etc.), which also must be explicitly specified.

Collation Details

데이터 정렬은 선택적 두 번째 인자가 생략되거나 상수 화이트스페이스만 포함된 경우 지원됩니다.

반환된 값의 데이터 정렬 사양은 첫 번째 인자의 데이터 정렬 사양과 동일합니다.

문자열에서 후행 0. 문자를 제거합니다.

SELECT RTRIM('$125.00', '0.');

------------------------+
 RTRIM('$125.00', '0.') |
------------------------+
 $125                   |
------------------------+
Copy

Remove trailing whitespace from a string. This example encloses the strings in > and < characters to help visualize the whitespace:

SELECT CONCAT('>', CONCAT(v, '<')), CONCAT('>', CONCAT(rtrim(v), '<')) FROM tr;

-----------------------------+------------------------------------+
 concat('>', concat(v, '<')) | concat('>', concat(rtrim(v), '<')) |
-----------------------------+------------------------------------+
 >  <                        | ><                                 |
 >  asd  <                   | >  asd<                            |
 >  asd<                     | >  asd<                            |
 >  éché, la lé  <           | >  éché, la lé<                    |
 > <                         | ><                                 |
 ><                          | ><                                 |
 >asd  <                     | >asd<                              |
 [NULL]                      | [NULL]                             |
-----------------------------+------------------------------------+
Copy