rtrim function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Returns str with trailing characters removed.

Syntax

rtrim( [trimStr ,] str)

Arguments

  • trimStr: An optional STRING expression with characters to be trimmed. The default is a space character.

  • str: A STRING expression 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