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
| Parameter | Type | Required | Description |
|---|---|---|---|
string | VARCHAR | Yes | String 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 (useNULL(VARCHAR); bareNULLfails 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 VARCHAR | f2 VARCHAR | f3 VARCHAR | f4 VARCHAR | f5 VARCHAR | f6 VARCHAR | f7 VARCHAR | f8 VARCHAR |
|---|---|---|---|---|---|---|---|
| dlroW olleH | FEDCBA | 54321 | racecar | A | éfac | (empty) | NULL |
On this page