Skip to main content

RIGHT

Returns the right-most number of characters in a string.

Syntax​

RIGHT ( string_expression,  numeric_expression ) 

Arguments​

string_expression
A valid string expression.

numeric_expression
An expression that evaluates to numeric value.

Return Type​

Returns values of type STRING.

Remarks​

  • The numeric_expression must be non-negative.
  • If the number of characters exceeds the length of the string. The string is returned.

Examples​

Examples in this section use the example blockchain.

The following example returns the 2 right-most characters in str.

SELECT RIGHT(str, 2) FROM example;

Response:

RIGHT(str, 2) [STRING]
NULL
d
ct
ct