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
f1 := REVERSE('Hello World'), -- Reverse entire string
f2 := REVERSE('ABCDEF'), -- Alphabetic reversal
f3 := REVERSE('12345'), -- Numeric string reversal
f4 := REVERSE('racecar'), -- Palindrome stays same
f5 := REVERSE('A'), -- Single character
f6 := REVERSE('café'), -- Non-ASCII reversal
f7 := REVERSE(''), -- Empty string
f8 := REVERSE(NULL(VARCHAR)) -- NULL yields NULL
;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