New versions: Dev (3.14) | Latest (3.13) | 3.12 | 3.11 | 3.10 | 3.9 | 3.8 | Old versions: 3.7 | 3.6 | 3.5 | 3.4 | 3.3

TRANSLATE

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The TRANSLATE() function translates a set of characters to another set of characters within a string, based on matching positions within the search and replacement string.

SELECT translate('1 * [2 + 3]', '[]', '()');
create.select(translate(val("1 * [2 + 3]"), "[]", "()")).fetch();

The result being

+-------------+
| translate   |
+-------------+
| 1 * (2 + 3) |
+-------------+

Dialect support

This example using jOOQ:

translate(val("1 * [2 + 3]"), "[]", "()")

Translates to the following dialect specific expressions:

-- AURORA_POSTGRES, COCKROACHDB, H2, HSQLDB, ORACLE, POSTGRES, SQLSERVER
translate('1 * [2 + 3]', '[]', '()')

-- DB2
translate('1 * [2 + 3]', '()', '[]')

-- TERADATA
otranslate('1 * [2 + 3]', '[]', '()')

-- ACCESS, ASE, AURORA_MYSQL, CUBRID, DERBY, FIREBIRD, HANA, INFORMIX, INGRES, MARIADB, MEMSQL, MYSQL, REDSHIFT, 
-- SQLDATAWAREHOUSE, SQLITE, SYBASE, VERTICA
/* UNSUPPORTED */

(These are currently generated with jOOQ 3.14, see #10141)

The jOOQ Logo