REVERSE()

All functions > STRING > REVERSE()

Returns the string with all characters in reverse order.

Signatures

Returns: String with characters in reverse order

REVERSE(string: VARCHAR) → VARCHAR
sql
ParameterTypeRequiredDescription
stringVARCHARYesString to reverse

Notes

  • Reverses the string’s characters in display order (including non-ASCII characters as single code points)
  • REVERSE('') is ''; if the input is NULL the result is NULL (use NULL(VARCHAR); bare NULL fails inference)
  • A palindrome is unchanged after reversal

Examples

FeatureQL
SELECT
    -- Reverse entire string
    f1 := REVERSE('Hello World'),
    -- Alphabetic reversal
    f2 := REVERSE('ABCDEF'),
    -- Numeric string reversal
    f3 := REVERSE('12345'),
    -- Palindrome stays same
    f4 := REVERSE('racecar'),
    -- Single character
    f5 := REVERSE('A'),
    -- Non-ASCII reversal
    f6 := REVERSE('café'),
    -- Empty string
    f7 := REVERSE(''),
    -- NULL yields NULL
    f8 := REVERSE(NULL(VARCHAR))
;
Result
f1 VARCHARf2 VARCHARf3 VARCHARf4 VARCHARf5 VARCHARf6 VARCHARf7 VARCHARf8 VARCHAR
dlroW olleHFEDCBA54321racecarAéfac(empty)NULL

Last update at: 2026/06/20 10:08:10