Firebird Documentation IndexFirebird 2.1 Language Ref. UpdateInternal functions → REVERSE()
Firebird Home Firebird Home Prev: REPLACE()Firebird Documentation IndexUp: Internal functionsNext: RIGHT()

REVERSE()

Available in: DSQL, PSQL

Added in: 2.1

Description: Returns a string backwards.

Result type: VARCHAR

Syntax: 

REVERSE (str)

Examples: 

reverse ('spoonful')                 -- returns 'lufnoops'
reverse ('Was it a cat I saw?')      -- returns '?was I tac a ti saW'

Tip

This function comes in very handy if you want to group, search or order on string endings, e.g. when dealing with domain names or email addresses:

create index ix_people_email on people
  computed by (reverse(email));

select * from people
  where reverse(email) starting with reverse('.br');
Prev: REPLACE()Firebird Documentation IndexUp: Internal functionsNext: RIGHT()
Firebird Documentation IndexFirebird 2.1 Language Ref. UpdateInternal functions → REVERSE()