This topic describes how to use the string function REVERSE in Realtime Compute.

Syntax

VARCHAR REVERSE(VARCHAR str) 

Input parameters

Parameter Data type Description
str VARCHAR A string.

Description

Returns a string in the reverse order of the specified string. If any input parameter is set to null, null is returned.

Example

  • Test data
    str1 (VARCHAR) str2 (VARCHAR) str3 (VARCHAR) str4 (VARCHAR)
    iPhoneX Alibaba World null
  • Test statements
    SELECT  REVERSE(str1) as var1,REVERSE(str2) as var2,
            REVERSE(str3) as var3,REVERSE(str4) as var4
    FROM T1;          
  • Test results
    var1 (VARCHAR) var2 (VARCHAR) var3 (VARCHAR) var4 (VARCHAR)
    XenohPi ababilA dlroW null