Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
Databricks SQL
Databricks Runtime
Returns str with trailing characters removed.
Syntax
rtrim( [trimStr ,] str)
Arguments
trimStr: An optionalSTRINGexpression with characters to be trimmed. The default is a space character.str: ASTRINGexpression to be trimmed.
Returns
A STRING.
The function removes any trailing characters within trimStr from str.
Examples
> SELECT rtrim('SparkSQL ') || '+';
SparkSQL+
> SELECT rtrim('ab', 'SparkSQLabcaaba');
SparkSQLabc
> SELECT rtrim('AB', 'SparkSQLabcaaba' COLLATE UTF8_BINARY);
SparkSQLabcaaba
> SELECT rtrim('AB', 'SparkSQLabcaaba' COLLATE UTF8_LCASE);
SparkSQL
-- RTRIM collation can be used instead of the rtrim function in many cases.
> SELECT 'hello' = rtrim('hello '),
'hello' = 'hello ' COLLATE UTF8_BINARY_RTRIM;
true true